

#include <stdio.h> int feof(FILE *f);
feof tests whether the stream associated with the FILE object
addressed by f has reached end of file.
feof returns 0 if the file is not positioned at end of file, or nonzero
if the file is at end-of-file.
End of file is not detected until an attempt is made to read past end of file,
and a call to fseek or fgetpos always resets the end of file
flag.
feof is implemented as an inline function. The function includes a test
for a NULL FILE pointer and for a stream that failed to open. If you
#define the symbol _FASTIO, either explicitly or using the
compiler define option, an alternate function is used. This version of
feof bypasses these error checks, so it executes faster.
feof to determine the end of a file opened for reading.
#include <stdio.h>
main()
{
FILE *fp;
char c;
int count;
fp = fopen("tso:MYFILE", "r");
count = 0;
while (!feof(fp) && !ferror(fp)) {
c = getc(fp);
++count;
}
printf("The number of characters in the file 'MYFILE' was %d.n",
count-1);
}
ferror
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.