next up previous contents
Next: fft Up: リファレンスマニュアル Previous: fclose

  
feof

【目的】
feof - ファイルの終端に達したか調べる
【形式】
m = feof(id)
   Integer m;
   Integer id;
【詳細】
fclose(id)は,id = fopen() でオープンしたファイルのデータを 読み込むとき,ファイルの終端に達したか調べる。終端に達して いれば 1 ,終端に達していなければ 0 を返す。
【例題】
if ((id = fopen("afo", "r")) < 0) {
    error("Can't open %s", "afo");
}
while (length(str = fgets(id))) {
    printf("%s", str);
    if (feof(id)) {
        break;
    }
}
fclose(id);
【参照】
fopen(2.75), fclose(2.64)


Masanobu KOGA 平成11年10月2日