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 # Statement Programming Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
'This example shows the effect of using data delimiters with the PRINT #
'statement.
CONST A$ = "CAMERA, AUTOFOCUS", B$ = "September 20, 1989", C$ = "42"
Q$ = CHR$(34)
CLS 'Clear screen.
OPEN "INVENT.DAT" FOR OUTPUT AS #1 'Open INVENT.DAT for writing.
'Write A$, B$, C$ without delimiters.
PRINT #1, A$; B$; C$
'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$
PRINT First$; TAB(30); Second$; TAB(60); Third$: PRINT
NEXT
CLOSE #1
'Remove file from disk.
KILL "INVENT.DAT"
'Sample Output
'
'CAMERA AUTOFOCUSSeptember 20 198942
'
'CAMERA, AUTOFOCUS September 20, 1989 42