EasyManua.ls Logo

Commodore 1541 - Page 29

Commodore 1541
80 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...
GET*
The
GET#
retrieves
data
from
the
disk,
one
character
at
a
time.
FORMAT
FOR
THE
GET*
STATEMENT:
GETS
fileS,
variable
list
Data
comes
in
byte
by
byte,
including
the
CR, comma,
and
other
separating
characters.
It
is
much
safer
to
use
string
variables
when
using
the
GET*
statement.
You
will
get
a
BASIC
error
message
if
string
data
is
received
where
a
number
was
requested,
but
not
vice-versa.
EXAMPLES
OF
GETS
STATEMENT:
GETS
5,
AS
GETS
A,
BS,
C$,
D$
—-^-^^--^-^-^-^-^-^-^
^
_(
You
can
get
more
than
1
character
at
a
time
)
GET#5,
A
The
GET#
statement
is
extremely
useful
when
examining
files
with
unknown
con
tents
like
a
file
that
may
have been
damaged
by an
experimental
program.
It is
safer
than'lNPUTS
because
there
is
a
limit
to
the
number
of
characters
allowed
between
separators
of
INPUT
variables."
With
GET#,
you
receive
every
character,
and you
can
examine
separators
as well as
other
data.
Here
is
a
sample
program
that
will
allow
you
to
examine
any
file
on
the
disk;
10
INPUT
"FILE
NAME";FS
20
INPUT
"FILE
TYPE";TS
30
TS
=
LEFTS
{T$,l>
_
,„
40
IFTS<>"S"
THEN
IFTS<>"P"
THEN
IF
TS<>"U"THEN20
45
OPEN15,8,i5
50
OPENS^,'^:11
60
GOSUB200
70
GETS5.AS
80
IFST
=
0THEN90
85
IF
ST
=
64
THEN
CLOSE5,15:END_
87
PRINT
ST:STOP
90
PRINT
ASC(AS
+
CHR$(0)
100
GOTO70
200
INPUTS15,A$,BS,C$,DS
210
IFVAL(A$)>OTHEN
PRINTA$,B$,C$,D$:STOP
220
RETURN
23
IN
CASE
A
NULL
CHARACTER
IS
RtAD

Other manuals for Commodore 1541

Related product manuals