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

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

Advertisement

DISK BASIC
JOHN
Q.
DOElOO-01-001
<EN>
which
could not be
INPUT
back
into
two
variables.
The
statement:
PRINTttl,
fi*.;",";B*
would
produce:
JOHN
Q.
DOE,
100-01-001
which
could
be
INPUT*
back
into
two
variables.
This
method
is
adequate
if
the
string
data contains
no
delimiters
commas
or
<
EN
>
—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
Q." B$="100-01-001"
If
you
use
PRINTttL flfo'V'iB*
the disk
image
will
be:
DOE,
JOHN
Q.,
100-0 1-001
<EN>
When
you
try to
input
this
with
a
statement
like
INPUT#2,
fl$,
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:
PRINTS
CHR$<34>;
fi$;
CHR$C4);
B$
this
produces
the disk
image
"DOE,
JOHN
Q."100-01-001
<EN>
which
can be
read
with
a
simple
INPUT#2,
fi$,
B$
7-45

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents