EOF - test input end-of-file, or write output end-of-file.
Alternate Entry Name: .EOF
Usage:
B:
stat = eof( [unit] );
/* C users should use "feof" */
Where:
- unit
- is the number of the I/O unit to be tested or ended. If
"unit" is not specified, the current read unit
is tested for end-of-file.
- stat
- When testing an input unit, "stat" receives an
end-of-file indicator if the unit is at end-of-file. If
the file was opened with the "zc" option for
OPEN, EOF is indicated by a "stat" of -1;
otherwise, it is indicated by a "stat" of 0. In
the C library, the "zc" option is the default.
When writing on an output unit, "stat" always
receives a non-zero value.
Description:
If EOF is called for an input unit, the function tests whether
or not the unit is in end-of-file status. If EOF is called for an
output unit, the function writes an end-of-file on the unit. When
EOF is called to handle an output unit which is a disk file, an
end-of-file mark is written and a new block begun.
Note that using EOF on output units is only for very special
applications. Normally you would accomplish the same result by
closing the unit and reopening it with no rewind.
Note that an input unit is placed in end-of-file status only
after a read results in an end-of-file being detected.
See Also:
- expl c lib feof
- the ANSI C function to check for end-of-file. Note that
"feof" only works on input units and returns a
different value to indicate end-of-file.
Copyright © 1996, Thinkage Ltd.