Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-FileGET #n[,r] PUT #n[,r] RECORD #n,r n, r: iexp GET reads a data record from a random access file. Similarly, PUT stores a data record in such a file. The parameter n (0 to 99) is the channel number under which the file was OPENed, and the optional parameter r contains a value between 1 and the number of data records in the file, specifying the number of the data record to be read or stored. If r is omitted, the next record will be read or stored. RECORD sets the number of the record to be read or stored next with GET or PUT. (e.g. after RECORD #1,15 record number 15 will be read by GET #1.) Note: Only one record at a time can be added to a file. A FOR-NEXT loop etc. must be used for multiple record storage. Examples: OPEN "r",#1,"PERSONAL.INF",62 FIELD #1,24 AS name$,2 AT(*house&) FIELD #1,24 AS road$,12 AS town$ FOR i%=1 TO 3 INPUT "Name : ";n$ INPUT "House number: ";house& INPUT "Road : ";r$ INPUT "Town : ";t$ LSET name$=n$ LSET road$=r$ LSET town$=t$ PUT #1,i% CLS NEXT i% CLOSE #1 --> First a random access file (mode 'r') with a record length of 62 bytes is opened. With FIELD a data record is specified as consisting of 4 fields of 24, 2, 24, and 12 bytes respectively (adding up to 62, the record length specified in the OPEN statement). Then the program asks for three names and addresses. Each time the name, house number, etc. are inserted left justified into the appropriate variables and the whole data record is written to the file. In older versions of GFA BASIC instead of '2 AT(*house&)' it was necessary to use '2 AS house$' and then 'LSET house$=MKI$(house&)' etc. OPEN "r",#1,"PERSONAL.INF",62 FIELD #1,24 AS name$,2 AT(*house&) FIELD #1,24 AS road$,12 AS town$ FOR i%=1 TO 3 GET #1,i% PRINT "Record number: ";i% PRINT PRINT "Name : ";name$ PRINT "House number: ";house& PRINT "Road : ";road$ PRINT "Town : ";town$ PRINT PRINT NEXT i% CLOSE #1 --> Here the file PERSONAL.INF is opened in Random Access mode and the three records are read in and printed out. Memo: GET # and PUT # compiled issue the wrong error message if the field length changes. Should issue error #54 and not error #8. Version 2 had a limit of 65535 records, this limit is gone. Thus error code #55 was retired. Fread()+, Fwrite()+