Download Print this page

Radio Shack TRS-80 Owner's Manual page 167

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

Advertisement

Sequential
Lime
Input:
An
Example
Using
the line-oriented input,
you
can
write
programs
that edit
other
basic
program
files:
renumber
them, change lprints
to
prints,
etc.
as
long
as
these
"target"
programs
are stored
in
ascii format.
The
following
program
counts
the
number
of
lines in
any
ascii
format basic
disk
file
with
the
extension
/txt.
10
CLEAR
300
20
INPUT"WHAT
IS
THE NAHE OF THE PROGRAM"
5
PROG*
30
IF
INSTR(PROG$»"/TXT")=0
THEN
110
'require /TXT extension
40
OPEN"!"
,
1
»
PROG*
50 11=0
G0
IF
EOF(l) THEN
90
70
I
%
=
1
% +
i
:
LINE INPUT»1» TEHP$
80
GOTO
B8
98
PRINT PROG*"
IS"
1%
"LINES LONG,"
100
CLOSE: GOTO
20
110
PRINT "FILESPEC MUST INCLUDE
THE
EXTENSION
'/TXT'"
120
GOTO
20
For basic programs
stored
in ascii,
each
program
line
ends with
a carriage
return
character not
preceded
by
a
line
feed.
So
the
line input
in line
70
automatically reads
one
entire line
at
a time, into the variable
temps.
Variable
i%
actually
does
the
counting.
To
try
out the
program,
first
save
any basic program
using
the
a
(ascii)
option
(See
save)
.
Use
the
extension
/txt.
149

Advertisement

loading

This manual is also suitable for:

Model iii