
MKI$
CVI
MKS$
CVS
MKD$
CVD
B.3.2.1
Creating
A Random
File
-
The
following
program
steps-ari
required
to create
a
random
file.
OPEN
the file
for random
access
("R" mode).
This
example
specifies
a record
length
of 32
bytes.If
the record
length
is
omitted,
the default
is 128
bytes.
Use the FIELD
statement
to
allocate
space
in the random
buffer
for the variables
that
will
be written
to the random
file.
FIELD
i1 20 AS N$,
4 AS A$,
8 AS P $
Use LSET
to move
the data
into the random
buffer.
Numeric
values
must
be made
into
strings
when
placed
in
the buffer.
To do this,
use the
"make"
functions:
MKI$
to
make
an integer
value
into a
string,
MKS~
for a single
precision
value,
and MKD$
for
a double
precision
value.
~SET N$=X$
LSET A$=MKS $ (AMT)
LSET
P$=TEL$
Write
the data
from
the buffer
to the disk
using
the PUT
statement.
Look
at Program
B-4.
It takes
information
that
is input
at
the
terminal
and writes
it to a random
file.
Each
time
the
PUT statement
is executed,
a record
is written
to the
file.
The
two-digit
code
that
is
input
in line
30 becomes
the
record
number.
Summary of Contents for Basic Interpreter Basic 80
Page 1: ...5IA iC intc tit tcl c t ...
Page 2: ......
Page 6: ... ...
Page 10: ......
Page 26: ......
Page 33: ...2 5 Intentially left blank ...
Page 37: ...BASIC SO COMMANDS AND STATEMENTS 2 9 Intentially left blank ...
Page 112: ......
Page 136: ......
Page 140: ......
Page 160: ......
Page 165: ......
Page 166: ......
Page 174: ......
Page 176: ......
Page 182: ......
Page 184: ......
Page 190: ......