最終更新日時(UTC):
が更新

履歴 編集

function
<cstdio>

std::getc

namespace std {
  int getc(FILE* stream);
}

概要

ストリームから一文字読み取る。

関数でもマクロでも定義してよいため、引数が一度しか評価されない保証はない。

戻り値

読み取る文字があればその文字を、なければEOFを返す。

#include <cstdio>

int main() {
  int c;
  while ((c = std::getc(stdin)) != EOF) {
    std::putc(c, stdout);
  }
}

入力

abc

出力

abc

処理系