|
|
#include <stdio.h>int feof(FILE *stream);
The feof( ) function determines if the end of the file associated with stream has been reached. A nonzero value is returned if the file position indicator is at end-of-file; zero is returned otherwise.
Once the end of the file has been reached, subsequent read operations will return EOF until either rewind( ) is called or the file position indicator is moved using fseek( ).
The feof( ) function is particularly useful when working with binary files because the end-of-file marker is also a valid binary integer. Explicit calls must be made to feof( ) rather than simply testing the return value of getc( ), for example, to determine when the end of a binary file has been reached.
Related functions are clearerr( ), ferror( ), perror( ), putc( ), and getc( ).
|
|