See Also: Sequential File I/O, Close_Input, Close_Output, Direct_Input , Direct_Output, Read, Read_Block, Readln
To indicate that the end of a sequential input file has been reached.
Boolean
When read_block, read or readln encounters an end of file (eof) character, it sets SeqEOF true. If you use the direct_input command to open a file that is not found, SeqEOF is set true. If the filename in the direct_input command is "", seqof will be set to False.
SeqEOF is commonly used to control the execution of loops that read data from sequential files.
Open Trees
Direct_Input "trees.txt"
If (Not(SeqEOF)) Begin
Repeat
Clear Trees
Readln Trees.Species Trees.Height
Save Trees
Until (SeqEOF)
End
In this example, input file TREES.TXT is opened and, if it is found, data is read from it into new records of Database File trees. When the end of the file is reached, SeqEOF is set true, and the repeat ... until loop terminates (abort). If TREES.TXT is not found in the folder, SeqEOF will be set true by the direct_input command, and the repeat ... until loop loop will never execute.
Never rely on the value of the SeqEOF indicator other than on the line immediately following the line of code that sets it. Many different commands and messages alter the value of SeqEOF and other global indicators.
Different operating systems indicate eof in different ways. DataFlex interprets EOF in whatever way it is indicated in the host operation system and sets SeqEOF so that the condition may be dealt with a single version of the program whose commands are not operating system-dependent.
The following commands set SeqEOF false unconditionally: close_input, close_output, and direct_output.