Open
Opens a file.
Open <File Name> for Output | Input | Append as #<File No.>
Parameters
<File Name>
|
The file name of the file to be opened (character string).
|
<File No.>
|
The file number (integer) assigned to the file that is opened.
|
Return Value
None.
Description
Opens the <File No.> specified for the file in order to allow I/O processing of data in the file on the Memory Card.
After the I/O processing of data has been completed, the Close command is used to close the file.
Specify the following values in I/O mode.
Input : When data is to be read in from the file.
Output: When data is to be written to the file.
Append: When data is to be added to the file.
Specify a positive integer from 0 to 15 in <File No.>.Note that multiple files cannot be simultaneously opened using a single <File No.>.
The following I/O can be used in place of the <File Name> until the specified <File No.> is closed using the Close command.
Sequential file I/O operations can be combined using the Input# statement for reading data and the Print# statement for writing data, etc.
When the Open command is executed For Input for a file that does not exist, it becomes an "Illegal function call".
Example
Read in data until the end of the file.
Open "C:\input.dat" FOR INPUT As #1
For I&=0 To 255
DATA$ = Input$(8,#1)
DATA$(I&)=DATA$
If Eof(1)<>0 Then Exit For
Next
Close #1