Opens an ASCII or binary file. This function does not create the
file if it does not exist.
|
[Ok := ] File.OPEN(Filename)
|
Parameters
- File
-
Type: File
Specifies the file.
- Filename
-
Type: Text
Specifies the name and path of the file that you want to
open.
Property Value/Return Value
Type: Boolean
Specifies whether the file was opened. If you omit this optional
return value and if the file cannot be found, then a run-time error
occurs.
true if the file was opened; otherwise, false.
Differences Between the Classic
Client and RoleTailored Client
If you are running the RoleTailored client and you call OPEN on
a file variable that refers to an open file, then the function does
not automatically close the existing file and open the new file.
You must explicitly call the CLOSE Function
(File) to close the existing file. If you call OPEN on a
file that is already open, then a run-time error occurs.
If you are running the Classic client and you call OPEN on a
file variable that refers to an open file, then the function closes
the existing file and opens the new file. A run-time error does not
occur.
Example
This example shows how to open an .xml file for reading
in ASCII mode. To use this example, you must create the simple.xml
file at C:\temp and create the following variable.
Variable |
Data type |
TestFile
|
File
|
|
Copy Code |
TestFile.TEXTMODE(TRUE);
TestFile.WRITEMODE(FALSE);
TestFile.OPEN('C:\temp\simple.xml');
|
See Also