EasyManua.ls Logo

Commodore 1541-II - Page 55

Commodore 1541-II
104 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...
where
"file
#"
is
the
same
file
number
given
in
the
desired
file's
current
Open
statement.
During
any
given
access
of
a
particular
file,
the
file
number
must
remain
constant
because
it
serves
as
a
shorthand
way
of
relating
all
other
file-handling
commands
back
to
the
correct
Open
statement.
Given
a
file
number,
the
computer
can
look
up
everything
else
about
a
file
that
matters.
The
"data
list"
is
the
same
as
for
a
Print
statement
-
a
list
of
constants,
variables
and/or
expressions,
including
numbers,
strings
or
both.
However,
it
is
strongly
recom
mended
that
each
Print#
statement
to
disk
include
only
one
data
item.
If
you
wish
to
include
more
items,
they
must
be
separated
by
a
carriage
return
character,
not
a
comma.
Semicolons
are
permitted,
but
not
recorded
in
the
file,
and
do
not
result
in
any
added
spaces
in
the
file.
Use
them
to
separate
items
in
the
list
that
might
otherwise
be
confused,
such
as
a
string
variable
immediately
following
a
numeric
variable.
Note:
Do
not
leave
a
space
between
PRINT
and
#,
and
do
not
abbreviate
the
command
as
?#.
The
correct
abbreviation
for
Print#
is
pR.
EXAMPLES:
To
record
a
few
grades
for
John
Paul
Jones,
using
a
sequential
disk
file
#1
previously
opened
for writing,
we
could
use:
200
FOR
CLASS
=
1
TO
COURSES
210:
PRINT#1,GRADE$(CLASS)
220
NEXT
CLASS
320
GOSUB
59990:REM
CHECK
FOR
DISK
ERRORS
(assuming
your
program
includes
an
error
check
subroutine
like
the
one
in
the
last
chapter).
In
using
Print#
there
is
an
exception
to
the
requirement
to
check
for
disk
errors
after
every
file-handling
statement.
When
using
Print#,
a
single
check
after
an
entire
set
of
data
has
been
written
will
still
detect
the
error,
so
long
as
the
check
is
made
before
any
other
file-handling
statement
or
disk
command
is
used.
You
may
be
familiar
with
Print
statements
in
which
several
items
follow
each
other:
400
PRINT
NAME$,STREET$,CITY$
To
get
those
same
variables
onto
sequential
disk
file
number
5
instead
of
the
screen,
the
best
approach
would
be
to
use
three
separate
Print#
statements,
as
follows:
400
PRINT#5,NAME$
410PRBSfT#5,STREET$
420PRINT#5,CITY$
47

Table of Contents

Related product manuals