Explanation
LOC Function
Returns the current position within a file.Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
LOC(filenumber%) |
filenumber% | The number of an open file or device. |
For binary files, LOC returns the position of the last byte read or written. | |
For random-access files, LOC returns the number of the last record read from or written to the file. | |
For sequential files, LOC returns the current byte position in the file, divided by 128. |
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)