PRINT#file number,[USINGstring expressions;]list of expressions
file number is the number used when the file was opened for output.
string expressions consists of the formatting characters described in the PRINT USING statement.
list of expressionsconsists of the numeric and/or string expressions to be written to the file.
Double quotation marks are used as delimiters for numeric and/or string expressions. The first double quotation mark opens the line for input; the second double quotation mark closes it.
If numeric or string expressions are to be printed as they are input, they must be surrounded by double quotation marks. If the double quotation marks are omitted, the value assigned to the numeric or string expression is printed. If no value has been assigned, 0 is assumed. The double quotation marks do not appear on the screen. For example:
10 PRINT#1, A
20 PRINT#1, A
20 PRINT#1, "A"
If double quotation marks are required within a string, use CHR$(34)(the ASCII character for double quotation marks). For example:
100 PRINT#1,"He said,"Hello", I think"
He said, 0, I think
because the machine assigns the value 0 the variable "Hello."
100 PRINT#1, "He said, "CHR$(34) "Hello,"CHR$(34) " I think."
He said, "Hello," I think
If the strings contain commas, semicolons, or significant leading blanks, surround them with double quotation marks. The following example will input "CAMERA" to A$, and "AUTOMATIC 93604-1" to B$:
The PRINT# statement may also be used with the USING option to control the format of the disk file. For example:
PRINT#1, USING"$$###.##."; J; K; L
PRINT# does not compress data on the diskette. An image of the data is written to the diskette, just as it would be displayed on the terminal screen with a PRINT statement. For this reason, be sure to delimit the data on the diskette so that it is input correctly from the diskette.
In list of expressions, numeric expressions must be delimited by semicolons. For example:
PRINT#1, A; B; C; X; Y; Z
If commas are used as delimiters, the extra blanks inserted between print fields will also be written to the diskette. Commas have no effect, however, if used with the exponential format.
String expressions must be separated by semicolons in the list. To format the string expressions correctly on the diskette, use explicit delimiters in list of expressions. For example, the following:
10 A$="CAMERA": B$="93604-1"
20 PRINT#1, A$, B$
gives a diskette image of:
Because there are no delimiters, this would not be input as two separate strings. To correct the problem, insert explicit delimiters into the PRINT# statement as follows:
30 PRINT#1, A$; ","; B$
This gives the following diskette image, which can be read back into two string variables:
All Frank Sinatra recordings, All Beatles albums, All solo albums from John Lennon, Paul McCartney, George Harrison and Ringo Starr, All Beatles songs, List of Platinum selling albums, Database with hits from 1950 to 1999.
Sought after DLL files, Nutworks magazine (retro), Worldwide ISO and TLD codes, File extensions database, The Hackers dictionary, Free software for the Atari, Amiga and Macintosh, Nokia smartphone, PocketPC, List of all BASIC programming language commands, List of all DOS commands, Free Advanced Bash-Scripting Guide (Linux-Unix)