Function | readline |
Description | $50 =
Contains the specification for the remainder of the functions The string
in $50 contains: FILENAME, OFFSET_REGISTER, STRING_REGISTER
The FILENAME is the file that will be read - scanning for CR/LF The OFFSET_REGISTER is the register number which contains file offset. If OFFSET_REGISTER value is < 0, this means begin at start of file. STRING_REGISTER is the register the returned string is returned in. The return code ($status) will be the number of characters in the line. When an END OF FILE is reached, the value -2 will be returned. The OFFSET_REGISTER
will be automatically updated to point to the next part of the file.
|
Return codes | -1: Function could not be
located by Uniface
-2: End-of-file reached (normal exit) -10: File could not be located (or $50 is corrupt) -20: Invalid offset passed to the read routine 0 - n: Number of characters returned by the read function |
Example |
$50 = "ASCII.TXT, 11, 12" - Read ASCII.TXT from
offset $11 into $12
To read through an entire file, use the program as such:
$50 = "ASCII.TXT, 11, 12"
if ($status != -2)
|
3gl function | Use |
UseqOpen | $30 the path of the file
Result. if the file is found. In $31 the first record $status = -1 when EOF |
UseqNext | Read the next record and load it in $31
$status = -1 when EOF |