Syntax:
print# deviceID,[printItem [{,|;}[printItem]...]]
Description:
This statement writes information formatted as text to the open file or serial port specified by deviceID
. The list of printItem
's is interpreted and formatted the same way as in the print
statement. print#
normally writes a carriage-return character (ASCII character 13) after writing the final printItem
; to inhibit this behavior, put a comma or a semicolon at the end of the print#
statement.
print#
is typically used to write data which is to be viewed later in a text editor or word processing program; or to write data which is to be read later by the input#
statement. It generally formats its output differently than the write
and write file
statements, which are better suited for transferring the contents of memory directly to the device. For example, consider this sample program fragment:
a% = -1623
print #1, a%
write #1, a%
In this example, the print#
statement formats the number as text, and puts out 7 bytes, as follows:
00101101
(ASCII code for "-")
00110001
(ASCII code for "1")
00110110
(ASCII code for "6")
00110010
(ASCII code for "2")
00110011
(ASCII code for "3")
00100000
(ASCII code for a space character)
00001101
(ASCII code for a carriage-return character)
On the other hand, the write
statement puts out the binary contents of a%
. In memory, the short integer -1623
is stored as 1111100110101001; therefore, the write
statement puts out these two bytes:
11111001 10101001
See Also:
print; input#; write; write file; open; route