VMS Help PASCAL, Input Output, Misc, EOF *Conan The Librarian (sorry for the slow response - running on an old VAX) |
The EOF (end of file) function indicates whether the file pointer is positioned after the last component in a file by returning a Boolean value. Syntax: EOF[[( file_variable )]] The 'file_variable' is the name of the file variable associated with the input file. If you omit the name of the file, the default is INPUT. The file can be in either inspection or generation mode before EOF is called; however, end-of-file must be defined. The input operations GET, RESET, and FINDK are guaranteed to leave end-of-file defined. The file mode does not change after EOF has been executed. EOF returns TRUE when the file pointer is positioned after the last component in the file, and returns FALSE up to and including the time when the last component of the input file is read into the file buffer. You must attempt to retrieve another file component after the last to determine whether the file is positioned at end-of-file. When EOF is tested for a file with relative organization opened for direct access, the result is TRUE if the file is in inspection mode and the last GET or RESET operation positioned the file beyond the last existing component. If the file is in generation or undefined mode, the result of EOF is undefined. When EOF is tested for a file with indexed organization opened for keyed access, the result is TRUE if the file is in inspection mode and the last FINDK, GET, RESET, or RESETK operation positioned the file beyond the last component with the current key number. Successful attempts at FINDK, GET, RESET, and RESETK cause EOF to be FALSE. If the file is not in inspection mode, EOF is undefined. If you attempt to read a file after EOF becomes TRUE, an error occurs. See the "Compaq Pascal Language Reference Manual" for a complete description of the EOF function.
|