Download FSD-1_Floppy_Disk_Us..

Transcript
6.
SEQUENTIAL
FILES
Sequential
files
are
stored
and
read
sequentially
from
beginning to end.
There are basically three different types of
sequential files that can be used.
The first is the program
file, which is abbreviated in the directory as PRG.
The PRG is
the only sequential file that can store and read programs.
The
second file, sequential (SEQ), and the third file, user (USR),
are for data handling.
These two files must be opened just like
the command channel in the last chapter.
OPEN
PURPOSE:
Open
FORMAT:
OPEN file#,
direction"
The
a
sequential
device#,
file
number
is
the
device
number
command,
file.
the
same
is
channel#,
as
in
usually
"0:
previous
8,
the
name,
uses
type,
of
channel
the
number
OPEN
is
a
data channel,
2 through 14.
It's a good idea to use the same
number for both file and channel numbers,
for easy remembering
(you may have noticed this in previous examples).
The name is the file name, for which no wild cards or pattern
matching may be used if you're creating a write file.
The type
can be any one from the list below, or at least the first letter
of one.
The direction must be READ or WRITE, or at least their
first
letters.
FILE
TYPE
PRG
SEQ
USR
REL
EXAMPLES:
MEANING
Program file
Sequential file
User file
Relative (not implemented
OPEN
5,8,5,
"0:
DATA,
OPEN
A,B,C,"0:TEXT,
S,
in
BASIC
2.0)
R"
P,W"
OPEN A,B,C,"0:M +A$+ "U,W"
(OPENs a write file
with a name specified by the string variable A$)
OPEN 2,8,2
version of
"@0:
the
PHONES, S,
with a
file
W" (replaces
new one)
Once
a
file has been opened for reading
commands
can
be used
to actually
transfer
commands are PRINT#, INPUT#, and GET#.
14
old
or writing,
the data.
three
These