Download Print this page

Radio Shack TRS-80 model III Owner's Manual page 142

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

Advertisement

DISK
BASIC
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
file,
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
PRINTEND
OF
FILE"FILENM*
IF
EOF(NM)
THEN CLOSE
NM'Z
The
following
sequence
of
lines
reads
numeric
data
from data/txt
into
the
array a(
).
When
the
last
data character
in
the
file 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 A<100>
'ASSUMING THIS
IS
A
SAFE VALUE
10
OPEN
"I"
tl
*
"DATA/TXT"
20 11=0
30
IF
E0F(
I
)
THEN
70
40
INPUTtti
tfi(IX)
50
n.=n.+i
S0
GOTO
30
70
REM PROGRAM
CONTINUES HERE AFTER
DISK INPUT
LOC
Get Current Record
Number
file
number
is
a
numeric
expression
specifying the buffer
for
a
currently-
opiinrt^
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