FileSystem.Seek Method (Int32, Int64)
Returns a Long specifying the current read/write position in a file opened by using the FileOpen function, or sets the position for the next read/write operation in a file opened by using the FileOpen function. The My feature gives you better productivity and performance in file I/O operations than Seek. For more information, see FileSystem.
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
Seek returns a value between 1 and 2,147,483,647 (equivalent to 2^31 – 1), inclusive.
The following describes the return values for each file access mode:
Number of the next record read or written
Binary, Input, Output, Append
Byte position at which the next operation occurs. The first byte in a file is at position 1, the second byte is at position 2, and so on.
This example uses the Seek function to return the current file position. The example assumes TestFile is a file that contains records of the structure Record.
For files opened in Random mode, Seek returns the number of next record.
For files opened in modes other than Random mode, Seek returns the byte position at which the next operation occurs. Assume TestFile is a file that contains several lines of text.
This example uses the Seek function to set the position for the next read or write in a file.
For files opened in modes other than Random mode, Seek sets the byte position at which the next operation occurs. Assume TestFile is a file that contains several lines of text.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.