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

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

Advertisement

DISK BASIC
10 0PEN"0",1, "METRIC/TXT"
26
FORIJi=l
TO
7
39 READ
UNIT*,
FflCTR
40
PRINTM,
UNIT*;
", ";
FflCTR
50 NEXT
60 CLOSE
70
DRTfl
IN->CM,
2.
54001, MI->KM,
1.
60935,
FiCRE->SQ.
M,
4046.
86
80
DRTfl
CU.
IN-X.TR,!. 638716E-2,
GfiL->LTR,
3.
785
90 DATA
LIQ.
QT->LTR,
0.
9463,
LB->KG,
0.
45359
Line 10
creates a disk
file
named
METRIC/TXT,
and
assigns
buffer
1
for sequential
output
to that
file.
The
extension
/TXT
is
used because
sequential
output always
stores
the data
as
ASCII-coded
text.
Note:
If
METRIC/TXT
already
exists, line
10
will
cause
all its
data
to
be
lost.
Here's
why: Whenever
a
file
is
opened
for
sequential
output, the
EOF
marker
is
set
to
the beginning
of
the
file.
In
effect,
TRSDOS
"forgets" that
anything has
ever
been
written
beyond
this
point.
Line
40
prints
the current contents
of
UNITS
and
FACTR
to
the
file
buffer.
The
disk-write
won't
actually
take place
until
the buffer
is
filled
or
you
close
the
file,
whichever happens
first.
Since the
string
items
do
not contain
delimiters,
it is
not
necessary to
print explicit
quotes
around them.
The
explicit
comma
is
sufficient.
Line
60
closes
the
file.
The
EOF
marker
points to the
end of
the
last
data item,
i.e.,
0.45359,
so that
later,
during
input,
DISK BASIC
will
know when
it
has read
all
the
data.
7-60

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents