Returns a Long value that specifies the current read/write position in an open file.
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
The Loc function is zero-based; using it to retrieve the first byte in a file will return 0.
The Loc function is provided for backward compatibility and may affect performance. For non-legacy applications, the My.Computer.FileSystem object provides better performance. For more information, see File Access with Visual Basic.
The following describes the return value for each file access mode:
Number of the last record read from or written to the file.
Current byte position in the file divided by 128. However, information returned by Loc for sequential files is neither used nor required.
Position of the last byte read or written.
This example uses the Loc function to return the current read/write position in an open file. This example assumes that MyFile is a text file that has several lines of sample data.