There are three DataFlex commands for writing data to a sequential I/O file, they are: Write, Writeln, and Write_Hex. The first two are detailed below. Refer to the Language Reference for more information about each of these commands.
The Write command writes data to the output file. Write appends the data to the output file without creating a new line. A Writeln statement must be executed to advance output to the next line. The syntax for the Write command is:
Write [channel {channel-num.}] {value1} [{value2 .. valueN}]
Where:
If the channel specification is omitted then data is written to whichever channel was last referenced, or channel 1 if no channel has been referenced. Each Write command must specify at least one {value} to be written.
An example of using the Write command is:
Direct_Output "c:\Names.txt"
Write "Bill, Bob, Jane"
Writeln
Write "Mary, Stuart, John"
Writeln
Close_Output
The Writeln command writes data to an output file then outputs an end-of-line character. The Syntax of the Writeln command is:
Writeln [channel {channel-num.}] [{value1 .. valueN}]
Where:
If the channel specification is omitted then data is written to whichever channel was last referenced, or channel 1 if no channel has been referenced. If no {value} is specified then the Writeln command will simply add an end-of-line character to the output file.
An example of using the Writeln command is:
Direct_Output "c:\Names.txt"
Writeln "Bill, Bob, Jane"
Writeln "Mary, Stuart, John"
Close_Output