std::feof
提供: cppreference.com
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
ヘッダ <cstdio> で定義
|
||
int feof( FILE* stream ); |
||
与えられたファイルストリームの終わりかどうかをチェックするに達しています.
Original:
Checks if the end of the given file stream has been reached.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
パラメータ
stream | - | ファイルストリームをチェックする
Original: the file stream to check The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
値を返します
ストリームの終わりに達した場合はゼロ以外の値、そうでなければ0.
Original:
Nonzero value if the end of the stream has been reached, otherwise 0.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
ノート
最新のI / O操作によって報告されるように、この関数は、ストリームの状態を報告し、それが関連付けられているデータソースを調べません。最新のI / Oは、ファイルの最後のバイトを戻さstd::fgetcだった場合、例えば、
std::feof
は、ゼロ以外の値を返します。次のstd::fgetcは失敗し、エンド·オブ·ファイルをストリームの状態を変更します。だけにしてstd::feof
ゼロを返し.Original:
This function only reports the stream state as reported by the most recent I/O operation, it does not examine the associated data source. For example, if the most recent I/O was a std::fgetc, which returned the last byte of a file,
std::feof
returns non-zero. The next std::fgetc fails and changes the stream state to end-of-file. Only then std::feof
returns zero.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
典型的な使い方では、入力ストリームの処理が何らかのエラーで停止します。
feof
とstd::ferrrorその後、さまざまなエラー条件を区別するために使用され.Original:
In typical usage, input stream processing stops on any error;
feof
and std::ferrror are then used to distinguish between different error conditions.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
例
Run this code
#include <stdio.h> #include <stdlib.h> int main(void) { FILE* fp = fopen("test.txt", "r"); if(!fp) { perror("File opening failed"); return EXIT_FAILURE; } int c; // note: int, not char, required to handle EOF while ((c = fgetc(fp)) != EOF) { // standard C I/O file reading loop putchar(c); } if (ferror(fp)) puts("I/O error when reading"); else if (feof(fp)) puts("End of file reached successfully"); fclose(fp); }
参照
ファイル終端に達したかどうか調べます ( std::basic_ios<CharT,Traits> のパブリックメンバ関数)
| |
エラーをクリアします (関数) | |
現在のエラーに対応する文字列を stderr に出力します (関数) | |
ファイルのエラーを調べます (関数) | |
feof の C言語リファレンス
|