Get - Commodore 1541 User Manual

Disk drive
Hide thumbs Also See for 1541:
Table of Contents

Advertisement

GET#
The GET# retrieves data from the disk, one character at a time.
FORMAT FOR THE GET# STATEMENT:
GET# file#, variable list
Data comes in byte by byte, including the CR, comma, and other separating
characters. It is much safer to use string variables when using the GET# statement. You
will get a BASIC error message if string data is received where a number was requested,
but not vice-versa.
EXAMPLES OF GET# STATEMENT:
GET# 5, A$
GET# A, B$, C$, D$
GET#5, A
You can get more than 1 character at a time^
The GET# statement is extremely useful when examining files with unknown con
tents, like a file that may have been damaged by an experimental program. It is safer
than INPUT# because there is a limit to the number of characters allowed between
separators of INPUT variables.* With GET#, you receive every character, and you can
examine separators as well as other data.
Here is a sample program that will allow you to examine any file on the disk:
10
INPUT "FILE NAME";F$
20
INPUT "FILE TYPE";T$
30
T$ = LEFTS (T$,l)
40
IF T$O"S" THEN IF T$O"P" THEN IF T$O"U" THEN20
45
OPEN15,8,15
50
OPEN5,8,5,"0:" + F$ + "," + T$ 4- ",R"
60
GOSUB200
70
GET#5,A$
80
IFST = 0THEN90
85
IF ST=64 THEN CLOSE5,15:END
^ in CASE A
87
PRINT ST:STOP
|^-~~
(NULL CHARACTER
90
PRINT ASC(A$ + CHR$(0));
t
IS READ
100 GOTO70
200 INPUT#15,A$,B$,C$,D$
210 IF VAL(A$)>0 THEN PRINTA$,B$,C$,D$:STOP
220 RETURN
23

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents