The Open method opens a file
for reading, writing, or appending. An alias is assigned to the
opened file. This alias can then be used in successive calls to the
USFile component. The alias can also be used by the XML.Export method.
If the file is successfully
opened, the alias is returned. If a failure occurs, an error
message is generated.
The syntax is:
SELECT <Alias>, <Filename>,
<Mode> [, <encoding> "Encoding"]
||Alias is the alias to be assigned to the successfully opened
text file. The alias can be used in subsequent calls to USFile. It
is not case-sensitive.
||FileName is the name of the text file to be opened. The name is
allowed to contain environment variables.
||Mode is the mode in which the file should be opened. Possible
values are 'READ', 'WRITE' or 'APPEND'. When opening a file with
mode=WRITE, the existing contents of the file (if any) are
||Encoding (Optional Parameter) specifies the encoding that is to
be used. When opening a text file for reading or appending, the
encoding of the existing file is used. When opening a text file for
writing, by default it is opened in UTF-8 encoding. It is possible
to explicitly specify an encoding here when opening the file for
writing. The possible values are: ASCII and UTF16LE (UTF16 Little
Once you have finished writing
to a file that was successfully opened, you must close the file
using the USFile Close method.