Reread the OPEN function.
Action
Opens a text file.
Syntax
OPEN (file handle, "file name", mode)
Parameters
File handle
A numeric expression indicating the file handle of the file to open. Possible values range from 1 to 10.
File name
A string expression indicating the path and name of the ASCII file to open.
Mode
Optional parameter that indicates what should happen if the file does not exist. This parameter can have the following values:
0
If the file does not exist, OPEN fails with return code 2 (default).
1
If the file does not exist, OPEN will create a new file.
2
Opens the file for read access (default).
4
Opens the file for write access.
Note
These values are cumulative. So if you want to open a file for write access, and create it if it does not yet exist, you should specify 5. Notice however that a file can not be opened for read and write access at the same time.
Remarks
OPEN opens the ASCII file specified by file name, for the internal buffer indicated by file handle. KiXtart supports a maximum of ten open files, so file handle must be within the range of 1 to 10.
Returns
-3
File handle already in use
-2
Invalid file handle specified
-1
Invalid file name specified
0
File opened successfully
>0
System error
Example
IF Open(3, @LDRIVE + "\CONFIG\SETTINGS.INI") = 0
$x = ReadLine(3)
WHILE @ERROR = 0
? "Line read: [" + $x + "]"
$x = ReadLine(3)
LOOP
ENDIF
_________________________
Today is the tomorrow you worried about yesterday.