Important: For a given alias, the VaToolBx DLL must have already been loaded (using the LOAD_DLL instruction) when the VaToolBxOpenFile function is called, and must still be loaded when the VaToolBxReadString function is called.
This function is used to read a string in a text file. The text is read from the current position to the next carriage return.
Context
Windows client,
Windows server,
Mobile client,
Mobile server,
Java client,
Java server,
Adelia Web client,
Adelia Cloud client.
Note: Encoding management and 'i' mode are not taken into account in mobile generation.
Parameters
ALPHA(n) |
Alias |
File name. |
ALPHA(n) |
Buffer |
Variable read by the function. |
NUM_BIN_4 |
Size |
Size (n) of the Buffer parameter. |
NUM_BIN_4 |
ReturnCode |
Return code for the operation: 0 Operation completed successfully. 2 Alias not defined. 4 Unable to read file. 6 End of file reached, 11 Error during character conversion, 12 Strict binary mode not supported, 13 Invalid opening mode. |
Notes:
By default ('t' or 'b' mode), if no encoding is specified in the file opening mode, the file is ready with ANSI encoding even if the host program is generated in UNICODE.
On the other hand, if encoding is specified, then:
- if the read file contains a BOM, the encoding used is that of the BOM.
- if the read file does not contain a BOM, the encoding used is that specified in the opening mode.
Strict binary mode ('i') is not supported by the function.
Example
Alias = 'TextFile'
CALL_DLL 'VATOOLBX.DLL' 'VaToolBxReadString' Alias Buffer Size ReturnCode
List of the VaToolBx functions by topic