Atari
BASIC
Reference Guide
131
The INPUT statement recovers data that was stored
with
the
PRINT statement.
EXAMPLE
10
DIM
A$(100)
20
OPEN
#1,
4,
0,
lie"
30
INPUT
#1
, A$
40
PRINT
A$
50
CLOSE
#1
The previous example contains a
program
that
reads and displays
one
string value. Line
10
dimensions the variable A$. Line
20
opens
I/O
channel
#1
for
input
from
the Program Recorder.
When
line
20
is
executed, the
tone
sounds
to
remind
the
operator
to
find
the
correct
position
on
the
tape, press
PLAY
on
the Program Recorder then press RETURN
on
the
keyboard
.
When
line
30
is
executed,
one
string value
is
read
from
the
cassette and assigned to the variable A$. Line
40
causes
the
value
of
A$
to
be displayed
on
the screen. Line
50
closes the
I/O
channel.
Before
an
INPUT statement can be used
with
the Program
Recorder,
the
data must have been
put
on
the
cassette
with
a
PRINT statement.
The
INPUT statement can also be used
to
recover data that
was
saved
on
a disk. The INPUT statement
has
the same
configuration
with
the disk and cassette. The INPUT statement must
includean
I/O
channel
number
and variable names.
The
OPEN statement
for
the I/ O channel must
include
the
channel
number
and the
operation
code
4
(input)
or
12
(input
and
output)
. The
third
argument
of
the
OPEN statement
is
zero,
and
fourth
argument
is
the device and filename.