Radio Shack TRS-80 Model 100 Basic Manual page 130

Basic language lab
Hide thumbs Also See for TRS-80 Model 100:
Table of Contents

Advertisement

To terminate the program, simply press
(ENTER)
when prompted for a name.
To confirm that a data file has been created in RAM, press
ern
for a list of files. You
should see the filename:
NAMES.DO
in the list of files.
Since none was specified, the extension" .00" was automatically added to the
filename and indicating this is a "DOcument" file.
Line
1tt
This statement clears the display.
Line
11t
The data file must be defined in an
OPEN
statement before data
aan
be
written to it. The statement:
OPEN "RAM:NAMES" FOR OUTPUT AS 1
defines a RAM file with the filename "NAMES.DO" which can be. used for output
with file number 1. Note that the extension to the filename will default to ".00" if
an extension is not specified.
Line
12t
The INPUT statement prompts you to enter a name from the keyboard. It is
stored in the string variable N$.
Line
139 The IF statement checks for a null entry to determine the end of the list.
Line 148 If a file number is added to the PRINT statement, as in
PRINT #1, N$
the items in the print list will be output to the file corresponding to the file number.
The file number must have been previously defined in an OPEN statement. In this
case, file number I is a RAM file.
Line 15t
The string variable N$ must be reset to a null string "" in order to detect a
null input in line 130. If this were not done, N$ would retain its last input value, and
a null input could not be detected.
The program loops back to Line 120 to allow another name to be input.
Line 200
The
CLOSE
statement terminates access to the data file and marks the end
of the file.
Since this program will be used again later in this lesson, you should save the program
by entering:
SAVE IEXP1"
124

Advertisement

Table of Contents
loading

Table of Contents