in BASIC ROM:
|List of all BASIC keywords|
Type: Command General Programming-Syntax: GET# <logic file number>,<variable>[,<variable>...]
The BASIC command GET# reads single characters from the specified device or the opened file. Before GET# can be used, it is necessary to open the device or the file with the command OPEN with the same logical file number. The character read in this way is stored in a variable (string, floating point, integer). If this variable is of a numeral type and the character is no numeral, the interpreter will report a "?SYNTAX ERROR IN line" XYZ. Therefore, string variables are preferable to foolproof the use of GET#. Furthermore, GET# cannot be used outside of BASIC programs. Otherwise an "?ILLEGAL DIRECT ERROR" will occur.
When reading from tape or disk, GET# converts incoming CHR$(0) to an empty string.
After the end of a file on a disk, GET# continuously returns CHR$(199). This can be avoided by detecting the end-of-file with the STATUS command.
All characters are accounted for. An exception is the use of GET# on the screen. After every reading operation from the screen, the cursor moves one column to the right and the end of a logical screen line (after 80 characters) is automatically set the CHR$(13).character =
10 REM COPYING 255 SCREEN CHARACTERS TO A STRING VARIABLE 20 PRINT CHR$(19);: B$="": OPEN 1,3 30 GET#1,A$: B$=B$+A$: IF LEN(B$)<255 THEN 30 40 CLOSE 1 50 PRINT CHR$(147);B$