EasyManua.ls Logo

Radio Shack TRS-80 Model 4 - Page 180

Radio Shack TRS-80 Model 4
418 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...
Example
LINE
INPUT,
"NAME?
";
N$
inputs data from the keyboard and stores it
in
variable N$.
3.
To write data to the file, use the
WRITE#
statement (you can also
use PRINT#, but make sure you delimit the data).
Example
WR
ITE#
1,
N$
writes variable N$ to the file, using buffer 1 (the buffer used to
OPEN the file). Remember that data must go through a buffer
before it can be written to a file.
4.
To ensure that all the data was written to the file, use the CLOSE
statement.
Example
CLOSE 1
closes access to the file, using buffer 1 (the same buffer used to
OPEN the file).
Sample Program
10
OPEN
"0",
1,
"LIST/EMP"
20
LI
NE
INPUT "NAME?
";
N$
30
IF
N$
= "DONE"
THEN
60
1I0 WRITE#
1,
N$
50
PR
I NT:
GOTO
20
60
CLOSE 1
RUN
NOTE: The file "L1ST/EMP" stores the data you input through the
aid of the program, not the program itself (the program
manipulates data). To save the program above, you must assign it
a name using the SAVE command (refer to Chapter 1).
Example
SAI.IE
"PAYROLL"
would save the program under the name "PAYROLL".
NOTE: Every time you modify a program, you must SAVE it again
(you can use the same name); otherwise, the original program
remains on disk, without your latest corrections.
5.
To access data
in
the file, reOPEN it in the
"I"
(input) mode.
Example
OPEN
"I",
1,
"LIST/EMP"
2-52

Other manuals for Radio Shack TRS-80 Model 4

Related product manuals