Download Print this page

Radio Shack TRS-80 Owner's Manual page 151

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

Advertisement

PRINTS!
,
Mi"
f"
iB$
would
produce;
JOHN
0.
DOE* 100-01
-iBi
which
could be
input#
back
Info
two
variables.
This
method
is
adequate
If
the
string
data contains
no
delimiters
commas
or
(EMTER)
characters.
But
if
the data
does
contain
delimiters or leading
blanks
that
you
don't
want
to
Ignore,
then
you must
supply
explicit
quotes
to
be
written
along with
the
data.
For example, suppose A$=
"
DOE
»
JOHN
,
"
and B$=
"
IBB
-01-001"
if
you
use
PRINT*!
»A*i"
."
5B*
the
disk
image
will be:
DOE. JOHN
0,
»!0g-0i-0Bi
CtWTETO
When
you
try to
input
this
with
a
statement
like
1NPUT82sA*;B*
a$
will
get the
value
doe, and
b$
will
get
john
q.
because of
the
comma
after
doe
in
the
disk
Image.
To
write
this
data so
that
it
can be
Input
correctly,
you must
use
the
chr$
function
to Insert explicit
double quotes
Into the
disk
Image. Since
34
is
the
decimal
ascii
code
for
double
quotes,
use
chr$(34)
as
follows:
PR
I
NT*
1
.CHR$C34) ?A$?CHR$(345
IB*
this
produces
the disk
Image
"DOE. JOHN
Q
f
"iBB-0i-B01
CENTER
)
which
can be
read with a simple
INPUT»2.A*B$
Mote:
You
can
also
use
the
chr$
function
to insert
other delimiters
and
control
codes
Into the
file,
for
example:
chr$(10)
©
Line
Feed
chr$(13)
carriage return
(
(ENTERl
character)
chr$(1
i)
or chr$(12)
line-printer
top-of-form
USING
Option
This option
makes
it
easy
to
write
files
in
a
carefully controlled format.
For example,
suppose:
A*="LUDWIG"
133

Advertisement

loading

This manual is also suitable for:

Model iii