Seek Procedure


Seek Procedure

Class

Microsoft.VisualBasic.FileSystem

Syntax

     Seek(fileNumber, position) 


filenumber (required; Integer)

Any valid file number of a file opened with FileOpen


position (required; Long)

The new 1-based position within the file, to be used for the next read or write operation

Description

The Seek procedure moves the current position within an open file such that the next data read or written will be at the 1-based location position. For files open in Random mode, this is the next record number; for files open in other modes, this is the byte position.

Usage at a Glance

  • The use of a record number in any subsequent FileGet or FilePut procedure overrides the position set by the Seek procedure.

  • position can be set to a value that is well beyond the end of the file. The file size will be automatically increased as needed during the next write operation.

  • A runtime error occurs if position is 0 or negative.

  • Unwritten records in a data file are generally padded with spaces. For example, if you open a brand new data file, perform a seek operation to record number 10, and then write a new record, the preceding nine records will be padded as needed.

Version Differences

In Visual Basic 2005, the My.Computer.FileSystem object provides more robust access to file management features.

See Also

Seek Function




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net