EasyManua.ls Logo

Commodore 1541-II - More about INPUT (Advanced)

Commodore 1541-II
104 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
but
many
programs
cheat
on
safety
a
bit
ana
use
800
INPUT#5,NAME$,STREET$,CITY$
810
GOSUB
59990:REM
CHECK
FOR
DISK
ERRORS
This
is
done
primarily
when
top
speed
in
the
program
is
essential,
and
there
is
little
or
no
risk
of
reading
improper
data
from
the
file.
MORE
ABOUT
INPUT#
(FOR
ADVANCED
USERS)
Troublesome
Characters
After
you
begin
using
data
files
regularly,
you
may
encounter
two
Basic
error
messages
more
or
less
frequently.
They
are
"STRING
TOO
LONG
ERROR"
and
"FILE
DATA
ERROR".
Both
are
likely
to
halt
your
program
at
an
Input#
statement,
but
may
also
have
been
caused
by
errors
in
a
Print#
statement
when
the
file
was
written.
"STRING
TOO
LONG"
ERRORS
A
Basic
string
may
be
up
to
255
characters
long,
although
the
longest
string
you
can
enter
via
a
single
Input
statement
is
just
under
2
lines
of
text
(4
on
the
VIC
20).
This
lower
limitation
is
due
to
the
88
character
size
of
the
Input
buffer
in
Commodore's
serial
bus
computers.
The
same
limit
applies
to
Input#
statements.
If
a
single
data
element
(string
or
number)
being
read
from
a
disk
file
into
an
Input#
statement
contains
more
than
87
characters,
Basic
will
halt
with
a
"STRING
TOO
LONG
ERROR".
To
prevent
this
error,
be
sure
to
limit
each
string
to
under
88
characters,
and
separate
all
file
data
items
with
carriage
returns
(See
the
next
section
for
a
cure
once
the
error
has
occurred.)
"FILE
DATA"
ERRORS
The
other
error
message
"FILE
DATA
ERROR"
is
caused
by
attempting
to
read
a
non-numeric
character
into
a
numeric
variable.
To
a
computer,
a
number
is
the
characters
0
through
9,
the
"
+
"
an3
"
-
"
signs,
the
decimal
point
(.),
the
SPACE
character,
and
the
letter
"E"
used
in
scientific
notation.
If
any
other
character
appears
in
an
Input#
to
a
numeric
variable,
"FILE
DATA
ERROR"
will
be
displayed
and
the
program
will
halt.
The
usual
causes
of
this
error
are
a
mismatch
between
the
order
in
which
variables
are
written
to
and
read
from
a
file,
a
missing
carriage
return
within
a
Print#
statement
that
writes
more
than
one
data
item,
or
a
data
item
that
includes
either
a
comma
or
a colon
without
a
preceding
quotation
mark.
Once
a
file
data
error
has
occurred,
you
should
correct
it
by
reading
the
data
item
into
a
string
variable,
and
then
converting
it
back
to
a
number
with
the
Basic
Val()
statement
after
removing
non-numeric
characters
with
the
string
functions
described
in
your
computer
users
manual.
COMMAS
(,)
AND
COLONS
(:)
As
suggested
before,
commas
and
colons
can
cause
trouble
in
a
file,
because
they
delimit
(end)
the
data
element
in
which
they
appear
and
cause
any
remaining
characters
in
the
data
element
to
be
read
into
the
next
Input#
variable.
(They
have
the
same
effect
in
an
Input
statement,
causing
the
common
"EXTRA
IGNORED"
error
message.)
However,
sometimes
we
really
need
a
comma
or
colon
within
a
data
element,
such
as
a
name
written
as
"Last,
First".
The
cure
is
to
precede
such
data
elements
with
a
quotation
mark.
After
a
50

Table of Contents

Related product manuals