Futurebasic/Language/Reference/print pound
PRINT#
[edit | edit source]Syntax
[edit | edit source]PRINT# deviceID,[printItem [{,|;}[printItem]...]]
Description
[edit | edit source]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 "-")
(ASCII code for "1")
00110001
(ASCII code for "6")
00110110
(ASCII code for "2")
00110010
(ASCII code for "3")
00110011
(ASCII code for a space character)
00100000
(ASCII code for a carriage-return character)
00001101
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
[edit | edit source]PRINT;INPUT;WRITE;FILE;OPEN;DEF OPEN;ROUTE