QBasic 1.1: LOC Function



Description / Parameter(s)

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)