QBasic 1.1: SEEK Function
Explanation
SEEK Function and Statement
The SEEK function returns the current file position.
The SEEK statement sets the file position for the next read or write.
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
SEEK(filenumber%) |
SEEK [#]filenumber%, position& |
Description / Parameter(s)
filenumber% |
The number of an open file. |
position& |
The position where the next read or write occurs. For random-access files, a record number. For other files, the byte position relative to the beginning of the file. The first byte is at position 1. |
Example
OPEN "TEST.DAT" FOR RANDOM AS #1
FOR i% = 1 TO 10
PUT #1, , i%
NEXT i%
SEEK #1, 2
GET #1, , i%
PRINT "Data: "; i%; " Current record: "; LOC(1); " Next: "; SEEK(1)