Table of Contents

GET#

VIC-20 C16 Plus/4 C64 C128 M65

The GET# statement is used to read a single character from a file. The file must be opened beforehand with the same logical file number, using the OPEN statement.

Syntax

GET #<logical file no>, <variable>

The character that is read from the file is assigned to the specified variable as per the following rules:

  • If the variable is of a numeric type, it will be assigned the numeric PETSCII code of the character,
  • If the variable is a STRING, it will assigned the character itself, as string.

Warning

The variable must be predefined.

Warning

File I/O commands are not implemented for the Commodore PET.

Examples

REM -- dump raw contents of a file
DIM char$ AS STRING * 1
CONST EOF = 64
OPEN 2, 8, 2, "filename"
DO WHILE ST() <> EOF
  GET #2, char$
  PRINT char$;
LOOP
CLOSE 2