To read a record from a random disk file into a random buffer.
GET [#]file number[,record number]
file number is the number under which the file was opened.
record number is the number of the record, within the range of 1 to 16,777,215.
If record number is omitted, the next record (after the last GET) is read into the buffer.
After a GET statement, INPUT# and LINE INPUT# may be used to read characters from the random file buffer.
GET may also be used for communications files. record number is the number of bytes to be read from the communications buffer. record number cannot exceed the buffer length set in the OPEN COM(n) statement.
The following example opens the vendor file for random access, defines the fields, reads a record, then displays it:
10 OPEN "R", 1, "A:VENDOR.FIL" 20 FIELD 1, 30 AS VENDNAMES$, 20 AS ADDR$, 15 AS CITY$ 30 GET 1 40 PRINT VENDNAMES$, ADDR$, CITY$ 50 CLOSE 1
This example opens the file vendor.fil for random access, with fields defined in line 20.
In line 30, the GET statement reads a record into the file buffer.
Line 40 displays the information from the record just read.
Line 50 closes the file.