Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Eof Function
◄Summary► ◄Details► ◄Example► ◄Back►
Argument
file_variable Optional; open typed, untyped, or text file
(default is standard file Input)
Returns
Boolean True if file is empty or current position is past
last element in file, otherwise False
Description
The Eof function returns a Boolean value indicating whether the
current file position is beyond the last element in an open file
of any type. It checks the current position in the file. If Eof
finds an end-of-file marker, the actual end of the file, or an
empty file, it returns True. If Eof finds any other character, it
returns False. Eof does not change the current file position.
For text files, the end-of-file marker is the character CTRL+Z
(ASCII 26). The end-of-line marker is the character combination of
carriage return (ASCII 13) and line feed (ASCII 10).
Eof differs from the SeekEof function by not ignoring blanks, tabs,
and end-of-line markers in determining whether the end of a file
has been reached. Thus, SeekEof may be more useful than Eof for
reading text files of numeric data.
If file_variable is not associated with a file or if the file is
not open when Eof is called, an I/O error occurs.
To prevent a program from halting with a run-time error when an I/O
error occurs, turn off I/O checking with {$I-} and check the return
value of the IOResult function.