PRINT(hash)

From C64-Wiki
Jump to navigationJump to search
Disambiguation The title of this article is ambiguous. PRINT (Disambiguation).
BASIC keyword
Keyword: PRINT#
Abbreviation: pR
Type: Command
Token code: 152/$98
Handling routine
in BASIC ROM:
---;---
$----;----
List of all BASIC keywords


Remark: This article describes the BASIC command PRINT# in BASIC V2 on the Commodore 64.

Type: Command
General Programming-Syntax: PRINT# <logic file number>,<variable>[, (<--alternative ;)<variable>...]

The BASIC command PRINT# is used for storing data in a file. Before PRINT# can be used, the destination file has to be opened with the BASIC command OPEN. The PRINT# command must address the same logical file number as the preceding OPEN command.

Besides strings and numeric variables, any character may be included into string variables. But comma <,>, semicolon <;> and Space effect in separating the written data from each other. Other punctuation symbols do not have this effect.

For separating the data blocks, each must end with a Return character (CHR$(13)), which is done automatically if the PRINT# command is not followed by a punctuation symbol.

The written data can be read with the BASIC command INPUT#.

Examples[edit | edit source]

10 OPEN 1, 1, 1, "TESTFILE"
20 PRINT#1,"1st dataset" 
30 PRINT#1,"2nd dataset"," is continued";
40 PRINT#1," and further continued"
50 PRINT#1,"3rd dataset"+CHR$(13)
60 PRINT#1,"4th dataset"
70 CLOSE 1

Writing a data file on tape drive (check INPUT# for reading data).

10 OPEN 2, 8, 4, "TESTFILE, SEQ, W" 
20 PRINT#2,"1st dataset" 
30 PRINT#2,"2nd dataset"," is continued";
40 PRINT#2," and further continued"
50 PRINT#2,"3rd dataset"+CHR$(13)
60 PRINT#2,"4th dataset"
70 CLOSE 2

Writing a data file on first disk drive (check INPUT# for reading data).

BASIC V2.0 (second release) Commands

ABS | AND | ASC | ATN | CHR$ | CLOSE | CLR | CMD | CONT | COS | DATA | DEF | DIM | END | EXP | FN | FOR | FRE | GET | GET# | GOSUB | GOTO | IF | INPUT | INPUT# | INT | LEFT$ | LEN | LET | LIST | LOAD | LOG | MID$ | NEW | NEXT | NOT | ON | OPEN | OR | PEEK | π | POKE | POS | PRINT | PRINT# | READ | REM | RESTORE | RETURN | RIGHT$ | RND | RUN | SAVE | SGN | SIN | SPC | SQR | STATUS/ST | STEP | STOP | STR$ | SYS | TAB | TAN | THEN | TIME/TI | TIME$/TI$ | TO | USR | VAL | VERIFY | WAIT