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

履歴 編集

function
<cstdio>

std::fgetc

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

概要

指定されたファイルストリームから1文字入力する。

getcとは違い、関数として定義することが定められているため、引数は一度しか評価されないことが保証されている。

戻り値

入力された文字を返す。

#include <cstdio>

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

入力

abc

出力

abc

処理系