CLOSE

From C64-Wiki
Jump to: navigation, search
BASIC keyword
Keyword: CLOSE
Abbreviation: C, L, Shift+O
Type: Command
Token code: 160/$A0
Handling routine
in BASIC ROM:
57799–57811
$E1C7–E1D3
List of all BASIC keywords


Remark: This article describes the BASIC-Command CLOSE in BASIC V2 at the Commodore 64.

Type: Command
General Programming-Syntax: CLOSE <logical filenumber>

The BASIC-command CLOSE is used for closing opened files or drive numbers, so that the data can be written from the write buffer on tape or disk. If CLOSE is omitted after opening a file, the data of the file can be incomplete or unreadable. As a rule, CLOSE should be used whenever any of the BASIC-commands CMD, GET#, INPUT# or PRINT# has been used, but no further file access is needed anymore.

The numerical values from 0 to 255 are valid logical file numbers. Beyond that range - with negative values or values greater than 255 - the BASIC-error "?ILLEGAL QUANTITY ERROR IN" line occurs.

Examples[edit]

CLOSE 1
10 CLOSE Z (Z is a numerical variable between 0 and 255)
200 OPEN5,0:INPUT#5:CLOSE5:REM let the user type something with a blinking cursor (but without the question mark printed, which is the case for a plain INPUT)
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