Seek Procedure

   
Seek Procedure

Class

Microsoft.VisualBasic.FileSystem

Syntax

 Seek(   filenumber   ,   position   ) 
filenumber (required; Integer)

Any valid file number

position (required; Long)

Any whole number between 1 and 2,147,483,647

Description

Places the read/write marker at a given position where the next read/write operation should occur

Rules at a Glance

  • If the file has been opened in Random mode, position refers to the next record number that should be read or written.

  • In all other file open modes (Append, Binary, Input, and Output), position is the byte where the next read or write operation will start.

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

  • The size of a file can be increased as the result of a write operation that is performed after a call to the Seek procedure in which position is beyond the end of the file.

  • If position is 0 or negative, a runtime error will be generated.

Programming Tips and Gotchas

Unused records in a random-access data file are not necessarily blank. For example, if you open a brand new data file, then perform a seek operation to record number 10 and write a new record, the preceding 9 records will be filled with binary data that was present on the section of the disk used by the new file prior to its creation.

See Also

Seek Function

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

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