Tests for end-of-file on a stream.
int feof( FILE *stream );
Return Value
The feof function returns a nonzero value after the first read operation that attempts to read past the end of the file. It returns 0 if the current position is not end of file. There is no error return.
Parameter
stream
Pointer to FILE structure
Remarks
The feof routine (implemented both as a function and as a macro) determines whether the end of stream has been reached. When end of file is reached, read operations return an end-of-file indicator until the stream is closed or until rewind, fsetpos, fseek, or clearerr is called against it.
ferror
Tests for an error on a stream.
int ferror( FILE *stream );
Return Value
If no error has occurred on stream, ferror returns 0. Otherwise, it returns a nonzero value.
Parameter
stream
Pointer to FILE structure
Remarks
The ferror routine (implemented both as a function and as a macro) tests for a reading or writing error on the file associated with stream. If an error has occurred, the error indicator for the stream remains set until the stream is closed or rewound, or until clearerr is called against it.