EasyManua.ls Logo

Commodore 1570 - Page 63

Commodore 1570
132 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
NOTES:
I. Do not precede the file name (in BASIC 7.0) or the drive number (in
BASIC 2.0) with the
"at"
sign
(@);
there
is
no
reason to replace a relative file.
2. L record length (in BASIC 7.0) or, L
,"
+ CHR$(record length) (in BASIC
2.0)
is
only required when a relative file
is
first created, though
it
may used later,
so
long as the record length
is
the same
as
when the file was first created. Since
relative files may be read from or written to alternately and with equal ease, there
is
no need to specify Read
or
Write mode when opening a relative file.
3. "file
#",
"device
#"
and "channel
#"
must
be
valid numeric constants,
variables
or
expressions. The rest
of
the command must be a valid string literal,
variable
or
expression.
In
BASIC 7.0 DO PEN , whenever a variable or expression
is
used
as
a file name
it
must be surrounded
by
parentheses.
4.
Only I relative file can be open
at
a time on the 1571, although a sequential
file and the command channel may also be open
at
the same time. However, if you
have a sequential and relative file open at the same time, you can't request a
directory.
EXAMPLES:
use:
To create or reopen a relative file named
"GRADES",
of
record length 100, use
BASIC 7.0:
DOPEN#2,
"GRADES"
,LJ00.D0.U8
BASIC 2.0: OPEN
2,8,2,"GRADES.L,"
+CHR$( 1(0)
To reopen an unknown relative
file
of
the user's choice that has already been created.
BASIC 7.0: 200 INPUT"WHICH FILE";FI$
210 DOPEN#5.(FI$),D0.U8
BASIC 2.0: 200 INPUT"WHICH FILE";FI$
210 OPEN 5,8.5,FI$
USING RELATIVE FILES:
RECORD#
COMMAND
When a relative file
is
opened for the
fin,t
time.
it
is
not quite ready for use. Both
to
save time when using the file later, and to assure that the
file
will work reliably.
it
i,
necessary to create several records before closing the
file
for the first time.
At
a minimum.
enough records to
fill more than two disk sectors (512 bytes) should
be
written.
In
practice. most programs go ahead and create
as
many records
as
the program i, eventually
expected
to
use. That approach has the additional benefit
of
avoiding such problems
as
running out
of
room on the diskette before the entire
file
is
completed.
55

Related product manuals