GET
This page was last modified 16:09, 2 June 2020 by Mars2000you. Based on work by NYYRIKKI.

Contents

Effect

Reads a record from opened random access file to record buffer.

Syntax

GET # <FileNumber>,<RecordNumber>

The last parameter is optional. Parameters can not end with a comma alone.

Parameters

<FileNumber> corresponds to the number assigned to the file when opened with the OPEN instruction. It can vary between 1 and 15, but can't exceed the maximum number of files eventually defined with MAXFILES. The # in front can be omitted.

<RecordNumber> is a record number in integer format. Record size can be defined with the OPEN instruction. First record is 1. If this parameter is not given a next record is assumed. LOC() function can be used to return current record number.

Example

10 'Print BIN-file address info
20 LINE INPUT "Filename:";N$:OPEN N$ AS #1 LEN=7
30 FIELD #1,1 AS TP$, 2 AS BG$, 2 AS EN$, 2 AS ST$
40 GET #1:CLOSE
50 IF TP$<>CHR$(&HFE) THEN PRINT "Not a BIN-file":END
60 PRINT"Begin address: ";HEX$(CVI(BG$))
70 PRINT"End   address: ";HEX$(CVI(EN$))
80 PRINT"Start address: ";HEX$(CVI(ST$))

Related to

CLOSE, FIELD, LOC(), LSET, MAXFILES, OPEN, PUT, RSET, VARPTR

Compatibility

Disk BASIC 1.0 or higher