EasyManua.ls Logo

Tandy TRS-80 - Page 35

Tandy TRS-80
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...
NETHINGATA1
memory
by typing
NEW (ENTER) . Then type
and RUN
this
input
program:
100 OPEN "I".
#li
"CHECKS/DAT"
110 INPUT #1
.
A*
120 PRINT
At
130 CLOSE #1
This is
actually
just the
reverse of the output
program . .
.
Line 100
again
OPENs
communication to buffer
#1. This
time
communication is
OPEN for
"F
input. The
Computer
goes to the
disk's
directory to
find
where to
start
inputting
the file named
"CHECKS/DAT"
In line 110,
the Computer
INPUTs
the first data
item
from
the disk
file
named
"CHECKS/DAT"
and
labels
it A$. Line 120
PRINTs A$.
Finally, line 130
CLOSEs
communication
to
buffer
#1. In doing
this,
the Computer inputs
any
data
remaining in the
buffer.
JVoie:
You can
compare
an input program to the
LOAD
command. An input
program
inputs a dat<
file:
LOAD inputs a
program
file.
:
©V
ONE
CHECK AT
A TIME
At this
point, we've used
an
output program and
an input
program. Let's
combine
them into one
program.
Type:
10 OPEN
"0"
i
*1
i
"CHECKS/DAT"
20 WRITE
*1
.
"DR. HORN"
30 CLOSE
#1
100 OPEN "I"
t «li
"CHECKS/DAT"
110
INPUT
*1
, A$
120
PRINT
A*
130 CLOSE
*1
Now add
these
lines and RUN
the
program:
25 WRITE
*1
i
"SAFEWAY"
115 INPUT
«1
t B$
120
PRINT A$ t B*
Lines
10-30 output two
checks
into your
disk
file:
"
D R
HORNt"
"SAFEWAY"
Lines
100-130
input
them.
Try to input
more
than
two checks. Change
line 115 and 120:
115
PRINT
A$
120
GOTO
110
and
RUN
the program . .
.
The Computer
prints:
?IE ERROR IN 110
The
Computer is
notifying
you that you
are
asking
it to
input more
checks
than are
in
the
file.
Technically,
the IE
error
means you've
attempted
to
Input past the
End of
the File.
This error
makes
things difficult
when you want
to input all
the
data, but you
don't
know how
much is
in the file. We
showed
you this
error
so
you
would
appreciate our
new
word
EOF.
Type:
105 IF EOF(l)
120 GOTO 105
1 THEN 130
and RUN . . . EOF
checks
to see if
you've
reached
the end of buffer #1
{the
number in
parentheses).
If
you
have,
EOF(l)
equals a
-
1. If you
haven't,
EOF equals 0.
27