- Handling errors
- Position in the file
- Managing the ANSI/UNICODE format
In french: fLitLigne
Reads a line in an external file.
In this version, it is only possible to read lines in external files in ANSI format.
New in version 28
<Result> = fReadLine(<File used> [, <Separator>])
<Result>: Character string or UNICODE character string
- Line read in an external file.
- EOT constant if the end of file has been reached.
- Empty string ("") if an error occurred. In this case, the ErrorOccurred variable is set to True.
Remark: A line ends with a CR character (Carriage Return).
This parameter must be a character string.
<File used>: Integer or DiskFile variable
This parameter must be a variant.
<Separator>: Character string
Separator used between the lines. The default separator is the Carriage Return (CR).
This parameter is not available. The separator used is the Carriage return (CR).
New in version 28
fReadLine throws an error in the following cases:
- the file is not opened,
- the file is not accessible in read mode,
- the file is locked by another computer or by another application. fUnlock is used to unlock an external file.
Position in the file
When opening a file, the current position corresponds to:
- the first file byte (by default),
- the last byte of the file is the file is opened in "addition" mode (foAdd constant).
This position can be modified by fSeek
fReadLine reads the specified elements from the current position. Once fReadLine has been executed, the current position is set to the last byte read. fReadLine returns the EOT constant if the end of the file has been reached.
Managing the ANSI/UNICODE format
The fReadLine function reads:
- a Unicode string in a Unicode file.
- an Ansi string in an Ansi file.
The file is created or opened with fCreate
by specifying the file type.
Depending on the format of the external file used, some conversions are required once a character string was read in an external file:
|Current computer||External file |
in ANSI format
(fOpen or fCreate associated with the foAnsi constant)
|External file |
in UNICODE format
(fOpen or fCreate associated with the foUnicode constant)
|fReadLine function||PC running Windows||Read operation in ANSI format|
Conversion to UNICODE possible with AnsiToUnicode
|Mobile||Read operation in UNICODE format|
Conversion to ANSI possible with UnicodeToAnsi
: If the result of fReadLine
of an ANSI file is assigned to a UNICODE string (and vice versa), the conversion will be implicitly performed.
Business / UI classification: Business Logic
This page is also available for…