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 VaToolBxWriteFile function is called.
This function is used to write a series of ASCII or ANSI data in a text file. The text will be inserted at the current position in the file.
Context
Windows client,
Windows server,
Java client,
Java server,
Adelia Cloud client.
Parameters
ALPHA(n) |
Alias |
File name. |
ALPHA(n) |
Buffer |
Text to be written by the function. |
NUM_BIN_4 |
Ln |
Number of characters to write. If this value is greater than the length of the Buffer string, it will be completed with blank characters. In 'octet' mode, the length Lgth must not be greater than the length of the n size of the Buffer (where n*2 in C/UNICODE, Java generation). |
NUM_BIN_4 |
ReturnCode |
Return code for the operation: 0 Operation completed successfully. 2 Alias not defined. 5 Problem with write operation. |
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. If an encoding is specified, the possible blank characters added as complement follow this encoding.
In 't' mode, the line feed character is always replaced by the carriage return-line feed sequence.
ANSI generation 0A -> 0D-0A (if destEnc=ANSI or UTF-8); 0D-00-0A-00 (if destEnc=UTF-16LE); 00-0D-00-0A (if destEnc=UTF-16BE...)
Unicode generation (C) 0A-00 -> 0D-0A (if destEnc=ANSI or UTF-8); 0D-00-0A-00 (if destEnc=UTF-16LE); 00-0D-00-0A (if destEnc=UTF-16BE...).
Example
Alias = 'TextFile'
Buffer = 'Text To Add'
Ln = &STRING_LENGTH(Buffer)
CALL_DLL 'VATOOLBX.DLL' 'VaToolBxWriteFile' Alias Buffer Ln ReturnCode
List of the VaToolBx functions by topic