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 Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' This example shows the effect of using data delimiters with the PRINT #
' statement.
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the code example below to the code window
' 3. Press F5 to run the example
CONST A$ = "CAMERA, AUTOFOCUS", B$ = "September 20, 1992", C$ = "42"
Q$ = CHR$(34)
CLS ' Clear the screen
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$
PRINT First$; TAB(30); Second$; TAB(60); Third$: PRINT
NEXT
CLOSE #1
KILL "INVENT.DAT" ' Remove file from disk