A pseudo-variable allowing the random-access pointer of the file whose file handle is its argument to be read and changed.
PTR#F=PTR#F+5 :REM Move pointer to next number PTR#F=recordnumber*recordlength
Reading or writing (using BGET#, BPUT#, INPUT# or PRINT#) takes place at the current position of the pointer. The pointer is automatically updated following a read or write operation.
You can use PTR# to select which item in a file is to be read or written to next. In a random file you use PTR# to select the record you wish to read or write.
If you wish to move about in a file using PTR# you will need to know the precise format of the data in the file.
A file opened with OPENUP may be extended by setting its pointer to its end (PTR#fnum = EXT#fnum) and then writing to it.
By using PTR# you have complete control over where you read and write data in a file. This is simple concept, but it may initially be difficult to grasp its many ramifications.
Syntax
- PTR#<numeric>=<numeric>
- <n-var>=PTR#<numeric>