Download Print this page

Radio Shack TRS-80 Owner's Manual page 159

Mini-disk operation disk operating system disk basic programming language
Hide thumbs Also See for TRS-80:

Advertisement

DIS
This function checks
to
see
whether
all
characters
up
to
the end-of-file
marker
have been
accessed, so
you
can avoid input past
end
errors
during sequential
input.
Assuming nmexp
specifies
an
open
ile,
then
EOF(nmexp)
returns
(false)
when
the
eof
record has not
yet
been
read,
and
1
(true)
when
it
has
been
read.
Examples
IF
E0F(5) THEN PRINT"END
OF
FILE"FILENM$
IF
E0F(NM%) THEN CLOSE NM%
The
following sequence of
lines
reads
numeric
data
from data/txt
into the
array
a(
).
When
the
last
data character
in
the hie
is
read, the
eof
test
in line
30
"passes," so
the
program
branches
out
of
the
disk access loop, preventing
an input past
end
error
from
occurring.
Also
note
that
the variable
i
contains
the
number
of elements input
into
array
a(
)
5
DIM
AU00)
'ASSUMING THIS
IS A
SAFE VALUE
10
OPEN
"I"
,1
,
"DATA/TXT"
20
11=0
30
IF
EOF(l) THEN
70
M
INPUT*!
.Ad*.)
58
I
%
=
I
%
+
60
GOTO
30
70 REM
PROGRAM CONTINUES HERE AFTER DISK INPUT
LOC
Get Current Mecori
Number
tile
um&ti!
-i
%
mx.mvj,
iim^th;,
s&i^ifymu
trsfe
M;r&r
!o-
ea^nify-
loc
is
used
to
determine
the current
record
number,
i.e.,
the
number
of
the
last
record read
since the
file
was
opened,
loc
is
only
valid
after
a get.
Example
PRINT LOC(l)
141

Advertisement

loading

This manual is also suitable for:

Model iii