Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
LOC Function
◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Returns the current position within a file.
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.
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)
See Also ◄EOF► ◄SEEK►