Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
PRINT # and LPRINT Statement Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' This example shows the effects of using data delimiters with PRINT #
' and uses LPRINT to send the results to a printer.
CLS ' Clear the screen
A$ = "CAMERA, AUTOFOCUS": B$ = "September 20, 1985": C$ = "42"
Q$ = CHR$(34)
OPEN "INVENT.DAT" FOR OUTPUT AS #1 ' Open INVENT.DAT for writing
PRINT #1, A$; B$; C$ ' Write A$, B$, C$ without delimiters
' Write A$, B$, C$ with delimiters
PRINT #1, Q$; A$; Q$; Q$; B$; Q$; Q$; C$; Q$
CLOSE #1
OPEN "INVENT.DAT" FOR INPUT AS #1 ' Open INVENT.DAT for reading
FOR I% = 1 TO 2 ' Read first two records and print
INPUT #1, First$, Second$, Third$
LPRINT First$; TAB(30); Second$; TAB(60); Third$: LPRINT
NEXT
CLOSE #1