EasyManua.ls Logo

Commodore 1570 - Page 58

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...
3300 B$ =
""
3310GET#I,A$
3320 IF
A$<
>CHR$(I3)
THEN B$ = B$ + A$:GOTO 3310
The limit for such a technique
is
255 characters.
It
will ignore CHR$(0), but that may be
an advantage
in
building a text string. If CHR$ (0)
is
required
in
the file, then use the
following alternate line:
3320 If
A$<>CHR$(l3)
THEN
B$=
B$+(A$
+ CHR$(0): GOTO 3310
GET#
may
be
useful
in
recovering damaged files, or files with unknown contents.
The BASIC reserved variable ST (the
file
STatus variable) can be used
to
indicate when
all
of
a properly closed
file
has been read.
500
GET#2,S$
510
SU=ST:REM
REMEMBER FILE STATUS
520 PRINT S$;
530 IF SU = 0 THEN 500:REM
IF
THERE'S MORE TO
BE
READ
540
IF
SU<>64
THEN PRINT "STATUS ERROR: ST =
";SU
Copying
ST
into SU
is
often
an
unneccessary precaution, but must be done if any other
file-handling statement appears between the one which read from the
file
and the one that
loops back to read again. For example,
it
would be required if line 520 was changed
to
520
PRINT#
I.S$;
Otherwise, the file status checked
in
line 530 would
be
that
of
the write file, not the read
file.
The following table applies to single errors or a combination
of
two or more errors.
POSSIBLE VALUES OF THE FILE STATUS VARIABLE" ST,"
AND THEIR MEANINGS
IF
ST=
o
All
is
OK
THEN
I Receiving device was not available (time out on talker)
2 Transmitting device was not available (time out on listener)
4 Cassette data
file
block was too short
8 Cassette data
file
block was too long
16
Unrecoverable read error from cassette, verify error
32 Cassette checksum error----one or more faulty characters were read
64 End
of
file reached (EOI detected)
128
Device not present, or end
of
tape mark found on cassette
50

Related product manuals