Loc
Loc function returns a number indicating the current position within a file opened using the Open statement.
The required FileNum argument must contain an Integer representing any valid number associated with an open file.
Syntax
Loc(FileNum)
FileNum:
An Integer or numeric expression representing any valid number in the range 1 to 511 inclusive, which is referenced by the file system to be associated with an open file.
Return Value
Returns a Long representing the current position within a file, the value dependant upon which file access mode the file was opened with:
Related Functions
Example
Dim lonLoc As Long
Dim strLine As String
Open "TESTFILE.txt" For Binary As #1 ' Open file
Do While lonLoc < LOF(1) ' Loop until end of file
strLine = strLine & Input(1, #1) ' Read character into variable
lonLoc = Loc(1) ' Get current position within file
Loop
<statements> ' Do stuff with retrieved data
Close #1 ' Close file