EOF(DOS) XENIX System V EOF(DOS)
Name
eof - Determines end-of-file.
Syntax
#include <io.h>
int eof (handle);
int handle;
Description
The eof function determines whether end-of-file has been
reached for the file associated with handle.
Return Value
eof returns the value 1 if the current position is end-of-
file, 0 if it is not. A return value of -1 indicates an
error; in this case errno is set to EBADF, indicating an
invalid file handle.
See Also
ferror(S), perror(S)
Example
#include <io.h> #include <fcntl.h>
int fh, count; char buf[10];
fh = open ("data",ORDONLY); . . .
/* The following statement tests for an end-of-file
condition ** before reading. */
while (!eof (fh)) { count = read (fh, buf, 10); .
. .
}
Notes
This call must be compiled with the -dos flag.
Page 1 (printed 8/7/87)