eof
Determines if the end of the file has been reached for a specified file.
Library:LibC
Classification:Other
Service:File and Directory I/O
Syntax
#include <fsio.h>
int eof (
int fildes);
Parameters
- fildes
-
(IN) Specifies a file descriptor.
Return Values
Returns one of the following:
- 1 if the current file position is at the end of the file.
- 0 if the current file position is not at the end of the file.
- -1 if an error is detected, and eof sets errno to the following.
Remarks
The eof function determines if the end of the file has been reached for the file whose file descriptor is given by the fildes parameter. Because the current file position is set following an input operation, eof can be called to detect the end of the file before an input operation beyond the end of the file is attempted.