Chapter
10
I
BASIC
Keywords
PRINT#
Statement
PRINT#
buffr,[USING
format] data[,data,
...I
Writes data items
to
a
sequential disk file.
Buffer
is the number assigned
to
the file when you opened it.
When you
first
open a file for sequential output, BASIC sets a
pointer to the beginning of the file-that
is
where PRINT#
starts writing the data items. At the end of each PRINT# opera-
tion, the pointer advances
so
that data items are written in
sequence.
A PRINT# statement creates
a
disk image similar
to
the image
a PRINT to the display creates on the screen.
For
this reason, be
sure
to
delimit the data
so
that
it
will be input correctly from
the disk.
PRINT# does not compress the data before writing it
to
disk.
It
writes an ASCII-coded image of the data.
When you include the USING option, data is written
to
the disk
in the format you specify. See PRINT USING.
Examples
If
A
=
123.45
PRINT#
l,A
writes this 9-byte character sequence
to
the file as:
hl123.45hl
carriage return
The punctuation in the PRINT list is very important. Unquoted
commas and semicolons have the same effect as they do in regu-
lar PRINT statements to the display.
For
example:
A
=
2300
B
=
1.303
PRINT#
1,
A,B
writes the data on disk as:
hl
2300
hlhlhlbhlbhlhlhlhl
1.303M
carriage return
276