Read¶
Include: Use System\FileSystem.pkg
See Also: Direct_Input, Read_Line, Read_Block, SeqEOF, SeqEOL, Write, Sequential Channels
Purpose¶
Reads whitespace- or comma-delimited values from a sequential input channel.
Syntax¶
Read [Channel {ChannelNumber}] {Variable} ...
Behavior¶
Read reads the next token into each variable. A token ends at a space, comma, or line terminator. When CR/LF handling is configured, the CR character is skipped.
The token is assigned into the destination variable using normal DataFlex conversion. Numeric, Boolean, date/time, and other scalar variables receive converted values when the text matches their normal format.
After the final token has been read, a further Read returns an empty value and sets SeqEof.
Use Seq_New_Channel when opening files in application code; see Sequential Channels.
Example¶
Handle hFile
String sWord
Get Seq_New_Channel to hFile
Direct_Input Channel hFile FILE "test1.txt"
Read Channel hFile sWord
While (not(SeqEof))
Read Channel hFile sWord
Loop
Close_Input Channel hFile
Send Seq_Release_Channel hFile