Xbasic

FILE.EOF Function

Syntax

EOF_Found_Flag as L = file_pointer.EOF()

Returns

EOF_Found_FlagLogical

Returns .T. if the end of the file has been reached, otherwise .F.

Description

Return TRUE if positioned at the end of the file.

Discussion

The EOF() method returns .T. (TRUE) if the end of the file referenced by the file object pointer is reached during a Read operation.

Example 

This script will write the contents of a text file to the Trace window.

filename = ui_get_file("Choose File", "Text File (*.txt)", "C:\a5\data\variable.txt", "X")
if (filename = "") then
    end
end if
file_pointer = FILE.open(filename, FILE_RO_SHARED)
while .NOT. file_pointer.eof()
    text = file_pointer.read_line()
    trace.writeln(text)
end while
file_pointer.close()

See Also