Declares a file open for use.
OPEN "file descriptor" ⎡ FOR ⎧ INPUT ⎫ ⎤ AS [#] file number
⎣ ⎩ OUTPUT ⎭ ⎦ └────┬────┘
numeric expression
OPEN "DATA1" FOR OUTPUT AS #1
CAS0:
is the default option when the device name is omitted from the file descriptor.FOR INPUT
makes sequential file input possible.FOR OUTPUT
makes sequential file output possible. A new file is created on the cassette tape.FOR INPUT
or FOR OUTPUT
is not specified:
CAS0:
, CAS1:
)
Error generatedCOM0:
)
Sequential file input/output specified#1
) can be open at any given time. Attempting to open two or more files results in an OP error.10 OPEN "CAS0:TEST" FOR OUTPUT AS #1
20 PRINT #1, "WRITE TEST"
30 CLOSE
Creates sequential file on cassette tape under the filename “TEST”.
10 OPEN "CAS0:TEST" FOR INPUT AS #1
20 INPUT #1,A$
30 CLOSE
Reads sequential file created in Sample 1.