DataFlex can read data from, and write data to, up to ten sequential I/O files simultaneously. Before you can read or write sequential data you must first open the file. The syntax for opening a file for input (reading) is:
direct_input [channel {channel-num.}] {file-name}
And the syntax for opening a file for output (writing) is:
direct_output [channel {channel-num.}] {file-name}
Where:
Examples of opening a file for sequential I/O are:
direct_input "c:\myDocs\Readme.txt"
direct_output sErrorLog
Whenever a file is opened for I/O it is assigned an I/O channel. DataFlex supports up to ten channels for simultaneous sequential file I/O. The channels are numbered 0..9.
The default channel for input is channel 0; the default channel for output is 1.
The channel that you assign to a file when it is opened for sequential I/O must be unused. When you close a file for sequential I/O the channel that was assigned to it becomes available for reuse.
Examples of opening a file for sequential I/O and explicitly assigning a channel number are:
direct_output channel 3 "c:\myDocs\Readme.txt"
direct_output channel iOutChannel "c:\autoexec.bat"
If the file named in a direct_input statement cannot be opened then the Boolean expression Seqeof returns True. The following example demonstrates how you can test for a valid input file name.
direct_input sActivityLog
If (seqeof) Showln "Error: can't open " sActivityLog