Important: For a given alias, the VaToolBx DLL must have already been loaded (using the LOAD_DLL instruction) when the VaToolBxOpenFile function is called.
This function is used to open a text file.
Context
Windows client,
Windows server,
Java client,
Java server,
Adelia Web client,
Adelia Cloud client,
Event Adelia client.
Note: Encoding management and 'i' mode are not taken into account in mobile generation.
Parameters
ALPHA(n) |
Alias |
Logical name given to the file to be opened. |
||||||||||||||
ALPHA(n) or IMAGE |
FileName or Buffer |
Access path and name of the (physical) file to be opened, or Buffer memory managed using an IMAGE variable. Note: The IMAGE Buffer parameter is applicable for Java context only. |
||||||||||||||
ALPHA(n) |
Mode |
File opening mode:
,enc=ANSI,enc=ASCII ,enc=UTF-8 ,enc=UTF-8-NO-BOM ,enc=UTF-16LE ,enc=UTF-16LE-NO-BOM ,enc=UTF-16BE ,enc=UTF-16BE-NO-BOM ,enc=UTF-32LE ,enc=UTF-32LE-NO-BOM ,enc=UTF-32BE ,enc=UTF-32BE-NO-BOM
Note: When the encoding is explicitly specified, in read or add, the encoding used is that of the file BOM as a priority if it exists. In write mode or when adding to an empty file, UTF-8, UTF-16LE, UTF-16BE, UTF-32LE and UTF-32BE encoding systematically add a BOM to the file. The same encoding name with "–NO-BOM" added needs to be used to obtain a file without BOM. By default, the encoding is ANSI. In the absence of BOM or in write mode, the UNICODE encoding is equivalent to the UTF-16BE encoding.
|
||||||||||||||
NUM_BIN_4 | CodeRetour |
Return code for the operation: 0 The operation was carried out correctly. 2 Alias already used. 3 The file could not be opened. 7 Memory problem. 9 Character converter initialisation problem. 10 Error when writing the BOM. 13 Invalid opening mode. 14 Encoding not compatible with opening mode. 15 Encoding not recognised/supported. |
Examples
Example 1:
Alias = 'TextFile'
FileName = 'C:\CONFIG\USER.TXT'
Mode = 'w'
CALL_DLL 'VATOOLBX.DLL' 'VaToolBxOpenFile' Alias FileName Mode ReturnCode
Example 2 (Java context only):
IMAGE Buffer
Alias = 'idInf1'
Mode = 'w'
CALL_DLL 'VATOOLBX.DLL' 'VaToolBxOpenFile' Alias Buffer Mode ReturnCoder
ExAmple 3 :
Alias = 'UTF8_TextFile'
FileName = 'C:\CONFIG\USER.TXT'
Mode = 'w,enc=UTF-8'
CALL_DLL 'VATOOLBX.DLL' 'VaToolBxOpenFile' Alias FileName Mode ReturnCode
List of the VaToolBx functions by topic