Products Downloads


French version


 

 

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 VaToolBxReadFile function is called.

 

This function is used to read in a text file.

 

Context

  • Windows client,

  • Windows server,

  • Java client,

  • Java server,

  • Adelia Cloud client.

Note: Encoding management and 'i' mode are not taken into account in mobile generation.

 

Parameters

ALPHA(n)

Alias

Logical name of the file to be opened.

ALPHA(n)

Buffer

Variable resulting from the read operation.

NUM_BIN_4

Size

As an input, number of characters ('t' or 'b' mode) or bytes ('i' mode) to read in the file. Size must be equal to or lower than the n size of the Buffer (or n x 2 for 'i' mode in C/UNICODE, Java generation).

As an output, the function modifies this value by indicating the number of characters ('t' or 'b' mode) or bytes ('i' mode) actually read and contained in the Buffer.

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 when converting characters.

 

Notes:

By default ('t' or 'b' mode), if no encoding is specified in the file opening mode, the text is encoded in ANSI even if the host program is generated in UNICODE.

However, if the encoding is specified, then:

  • if the read file contains a BOM, the encoding used is the one contained in the BOM.
  • if the read file contains no BOM, the encoding used is the one specified in the opening mode.

 

In 't' mode, the carriage return character which precedes a line feed character is always deleted.

 

Example

Alias = 'TextFile'

Size = n

CALL_DLL 'VATOOLBX.DLL' 'VaToolBxReadFile' Alias Buffer Size ReturnCode

 

List of the VaToolBx functions by topic

 

↑ Top of page

  • Aucune étiquette