2012年(6)
分类: C/C++
2012-03-22 23:22:04
函数名: feof
功 能: 检测流上的文件结束符
用 法: int feof(FILE *stream);
程序例:
#include int main(void) /* open a file for reading */ /* read a character from the file */ /* check for EOF */ /* close the file */
{
FILE *stream;
stream = fopen("DUMMY.FIL", "r");
fgetc(stream);
if (feof(stream))
printf("We have reached end-of-file\n");
fclose(stream);
return 0;
}