Loc Function |
No
Loc(filenumber)
filenumber
Use: Required
Data Type: Integer
Any valid file number.
A Long integer.
Determines the current position of the file read/write pointer.
If you have opened the file in random mode, Loc returns the record number of the last record read or written.
If you have opened the file in input or output mode (sequential), Loc returns the current byte position in the file divided by 128.
If you have opened the file in binary mode, Loc returns the position of the last byte read or written.
Dim hFile As Integer Dim lngPtr As Long, lngFileLen As Long Dim strBuffer As String hFile = FreeFile() Open "loc.bin" For Binary As #hFile lngFileLen = LOF(hFile) Do While lngPtr < lngFileLen strBuffer = strBuffer & Input(1, hFile) lngPtr = Loc(hFile) Loop Close #hFile Text1.Text = strBuffer
For sequential files, the return value of Loc isn't required and shouldn't be used.
13.58.182.39