RECORD

From C64-Wiki
Jump to: navigation, search
BASIC keyword
Keyword: RECORD
Abbreviation: R Shift+E
Type: Command
Token code:
Handling routine
in BASIC ROM:
List of all BASIC keywords


Remark: This article describes the BASIC-Command RECORD in BASIC 4.0 / V7.0 and later.

Type: Command
General Programming-Syntax: RECORD#<file number>,<record number>[<,><bytes>]

The BASIC command RECORD# is used to move a file pointer within a previously opened file in order to position it for the following GET#, PRINT# or INPUT#. It is used to read and write structured data in files, typically on floppy disks, avoiding the need to read byte-by-byte.

The default value for bytes is 1. When RECORD# is used for output using PRINT#, the system automatically adds enough 1-byte records to hold the data. For instance, if you run:

200 RECORD#1,1
210 PRINT#1,"HELLO"

five 1-byte records will be written to the file to hold HELLO. When used with GET# the bytes are always 1 and this parameter is ignored. bytes is primarily needed for INPUT#, to read the previously written string, one would use:

300 RECORD#1,1,5
310 INPUT#1,A$

Note that if the value for bytes is calculated, it needs to be placed in parens:

300 RECORD#1,(A*10+1)

Examples[edit]

10 DOPEN#1,"TEXTFILE",L80
20 FOR I=1 TO 10
30 RECORD#1,(I):REM has to be in parens
40 PRINT#1,"ABCDE"
50 NEXT
60 CLOSE#1
70 END

BASIC V7.0 Commands

ABS | AND | APPEND | ASC | ATN | AUTO | BACKUP | BANK | BEGIN | BEND | BLOAD | BOOT | BOX | BSAVE | BUMP | CATALOG | CHAR | CHR$ | CIRCLE | CLOSE | CLR | CMD | COLLECT | COLINT | COLLISION | COLOR | CONCAT | CONT | COPY | COS | DATA | DCLEAR | DCLOSE | DEC | DEF FN | DELETE | DIM | DIRECTORY | DLOAD | DO | DOPEN | DRAW | DS | DS$ | DSAVE | DVERIFY | EL | ELSE | END | ENVELOPE | ER | ERR$ | EXIT | EXP | FAST | FETCH | FILTER | FN | FOR | FRE | GET | GET# | GETKEY | GO64 | GOSUB | GOTO | GRAPHIC | GSHAPE | HEADER | HELP | HEX$ | IF | INPUT | INPUT# | INSTR | INT | JOY | KEY | LEFT$ | LEN | LET | LIST | LOAD | LOCATE | LOG | LOOP | MID$ | MONITOR | MOVSPR | NEW | NEXT | NOT | ON | OPEN | OR | PAINT | PEEK | PEN | (PI) | PLAY | POINTER | POKE | POS | POT | PRINT | PRINT USING | PRINT# | PUDEF | RCLR | RDOT | READ | RECORD | REM | RENAME | RENUMBER | RESTORE | RESUME | RETURN | RGR | RIGHT$ | RND | RREG | RSPCOLOR | RSPPOS | RSPRITE | RUN | RWINDOW | SAVE | SCALE | SCNCLR | SCRATCH | SGN | SIN | SLEEP | SLOW | SOUND | SPC( | SPRCOLOR | SPRDEF | SPRITE | SPRSAV | SQR | SSHAPE | ST | STASH | STEP | STOP | STR$ | SWAP | SYS | TAB( | TAN | TEMPO | THEN | TI | TI$ | TO | TRAP | TROFF | TRON | USR | VAL | VERIFY | VOL | WAIT | WHILE | WIDTH | XOR