Radio Shack TRS-80 Trsdos & Disk Basic Reference Manual page 149

Micro computer system
Hide thumbs Also See for TRS-80:
Table of Contents

Advertisement

DISK BASIC
Sequential
LINE
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
disk
file
with the extension
"/TXT".
16 CLEAR 300
20 INPUT "WHAT
IS
THE NAME OF THE
PROGRAM".;
PROG*
30
IF
INSTRXPROG*,
VTXT">=0
THEN 11© -REQUIRE /TXT EXTENSION
40 OPEN"
IM,
PROG*
50
r/.=e
60
IF
E0F<1)THEN
90
70
I5J=IJJ+1:
LINE
INPUT#1,
TEMP*
80 GOT 060
90 PR
I
NT "THE
PROGRAM IS"I£"LINES
LONG.
"
100 CLOSE: GOTO20
110 PRINT "FILESPEC MUST INCLUDE THE EXTENSION
VTXT'"
120 GOTO20
For
BASIC
programs
stored
in
ASCII, each
program
line
ends with
an
<
EN
>
character
not preceded
by
an
< LF >
line
feed.
So
the
LINE INPUT
in line
70
automatically reads
one
entire
line at
a
time, into the variable
TEMPS.
Variable
1%
actually
does
the
counting.
To
try
out
the
program,
save
DISKDUMP/BAS
as a
text
file:
LQAD-'DISKDUMP/BAS"
Um3ii
SAVE"DISKDUMP/TXT",A
BSEa
This
gives
you
a
second,
ASCII-format
version
of
DISKDUMP.
Now
type
in
the line-counter
program and
tell
it
to
examine
the
program
DISKDUMP/TXT.
7-63

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents