![]()
To meet your needs, we constantly work to improve Querix products.
This means that Lycia documentation is developing as well.
In case you have found a certain dissonance between the provided information and the actual behavior of Lycia 3 and/or your applications, please, let us know about this via documentation@querix.com so that we can introduce the necessary changes to our documentation.
Thank you for your attention and cooperation.
Before a channel object can be used, a channel associated with it must be opened. It can be either a file, a socket or a pipe. If a channel is not opened, any other methods associated with it will have no effect and will return a runtime error.
The OpenFile() method is used to open a file for writing, reading, or performing both these operations. The method requires two parameters of a character data type, the file name with optional path and the opening flag:
CALL chan_obj.openFile(filename, opening_flags)
The opening flag argument can be represented by one of the following characters:
|
Mode |
Flag |
Effect |
|
Read mode |
r |
Read from the file. If Path to the file is not specified, the input is performed from the file where the executable file is located. |
|
Write Mode |
w |
Write to an empty file. If Path to the file is not specified, the output is performed to the directory where the executable file is located. If the file does not exist, it will be created. |
|
Append Mode |
a |
Write to the end of the file (append). If Path to the file is not specified, the output is performed to the directory where the executable file is located. If the file does not exist, it will be created. |
|
Read And Write |
u |
Read and Write from and to the standard output and input. |
|
Binary mode |
b |
This flag can follow any of the listed above (e.g., "wb"). Used to avoid carriage return/line feed (CR/LF) translation. |
Here is an example of OpenFie() method usage:
CALL chan_obj.openFile("mytext.txt", "r")
This command will open or create the file named "mytext.txt" in the folder on the application server where the program executable is located.