feof

Tests the end-of-file indicator for a stream.

Library:LibC
Classification:ANSI
Service:File and Directory I/O

Syntax

  #include <stdio.h> 
   
  int feof (
     FILE   *fp);
  

Parameters

fp

(IN) Points to the file to be tested.

Return Values

Returns nonzero if the EOF indicator is set for the stream specified by fp.

Remarks

Because the EOF indicator is set when an input operation attempts to read past the end of the file, feof detects the end of the file only after an attempt is made to read beyond the end of the file. Thus, if a file contains 10 lines, feof does not detect the end of the file after the tenth line is read; it detects the end of the file once the program attempts to read more data.

See Also