OPEN¶
Function¶
OPEN opens file for I/O
Syntax¶
OPEN “file name” FOR {OUTPUT|APPEND|INPUT} AS file no.
Example¶
10 OPEN "OUTFIL.TXT" FOR OUTPUT AS 1
This will open the file “OUTFIL.TXT” for output from a Basic program as file number one.
10 OPEN "APPEND.TXT" FOR APPEND AS 3
This opens the file “APPEND.TXT” as file number three. Any data written to the file will be appended. MAXFILES must have previously been set to a minimum of three.
10 OPEN "INPUT.TXT" FOR INPUT AS 4
The file is opened for input as file number four, this will allow the data in the file to be read by a Basic program.
Remarks¶
When a file is OPENed HUNTER’S firmware automatically performs a checksum generation on the file and compares it to a value stored in the file directory, when the file was last CLOSEd. Any inconsistency will result in a ‘DSK ERROR’ being returned to the user.
The OPEN statement parameter FOR has three options OUTPUT, APPEND and INPUT, they perform the following functions:
- OUTPUT
This will open a file for output. Any data that is in the file will be lost.
- APPEND
This will also open a file for output, but any data that is output to the file will be added to the end of the data that is already present.
- INPUT
The file is opened for input. This will allow a Basic program to read data from the file.
The file number cannot be greater than the number specified in MAXFILES. If MAXFILES 3 has been specified the file number cannot be greater than three.