Format
OPEN string1, number1, string2
Description
This statement is used to open a file for input or output. Up to three
files may be open concurrently, these are known as file 1, 2, or 3. You
must specify with number1 which file number you wish to open this file as.
Number1 may only be a constant. The file mode is specified in string1.
The valid values are "I" for INPUT, "O" for OUTPUT, "A" for APPEND, and "R"
for RANDOM INPUT/OUTPUT. The file name is specified with string2. Any
errors returned from DOS on the OPEN call will be returned in the system
variable "ERROR".
Example
OPEN "I",3,"INFILE"
IF ERROR > 0 THEN PROCESSERROR:
OPEN "O",1,"A:\NEWFILE.DAT"
IF ERROR > 0 THEN PROCESSERROR:
In this example, two files are opened. File "INFILE" from the current disk
drive and directory will be opened as file number 3 for input. The file
"A:\NEWFILE.DAT" will be opened for output as file number 1. Note that if
"A:\NEWFILE.DAT" previously existed, it contents will be destroyed in
preparation for writing.
See Also
|