EasyManua.ls Logo

Radio Shack TRS-80 Model 4 - Page 181

Radio Shack TRS-80 Model 4
418 pages
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...
OPENs the file named L1ST/EMP for sequential input, using
buffer
1.
6.
To read data from the file and assign it to program variables, use
either
INPUT#
or LINE INPUT#.
Examples
INPUT#
1,
N$
reads a string item into N$, using buffer 1 (the buffer used when
the file was OPENed).
LINE
INPUT#
1,
N$
reads
an
entire line of data into N$, using buffer
1.
INPUT#
and LINE
INPUT#
each recognize a different set of
"delimiters" for reading data from the file. Delimiters are characters
that define the beginning or end of a data item. See Chapter 7 for
a detailed explanation of these statements.
Sample Program
10
OPEN
"1",1,
"LIST/EMP"
20
IF
EoF
( 1
),
THEN
100
30
INPUT#
1,
N$
40
PRINT
N$
50
GoTo
20
100
CLOSE
Updating
a
Sequential-Access
File
1.
To add data to the file, OPEN it
in
"E"
(extend) mode.
OPEN
"E",
1,
"LIST/EMP"
opens the file L1ST/EMP so that it can be extended. The data you
enter is appended to L1ST/EMP.
2.
To enter new data to the file, follow the same procedure as for
entering data
in
"0"
mode.
The following program illustrates this technique. It builds Upon the
file we previously created under the name L1ST/EMP.
NOTE: Read through the entire program first.
If
you encounter
BASIC words (commands or functions) that are unfamiliar to you,
refer to Chapter 7 for their definitions.
NEW
10
OPEN
"E",
1,
"LIST/EMP"
20
LINE
INPUT
"TYPE
A
NEW
NAME
OR
PRESS
<N)";
N$
30
IF
N$ =
"N"
THEN
60
40
WRITE#
1,
N$
50
GoTo
20
60
CLOSE
2-53

Other manuals for Radio Shack TRS-80 Model 4

Related product manuals