Seek Statement
Sets the position for the next read/write operation within a file opened using the Open statement.
Syntax
Seek [#]filenumber, position
The Seek statement syntax has these parts:
| Part | Description |
|---|---|
| filenumber | Required. Any valid file number. |
| position | Required. Number in the range 1 - 2,147,483,647, inclusive, that indicates where the next read/write operation should occur. |
Remarks
Record numbers specified in Get and Put statements override file positioning performed by Seek.
Performing a file-write operation after a Seek operation beyond the end of a file extends the file. If you attempt a Seek operation to a negative or zero position, an error occurs.
Example
This example uses the Seek statement to set the position for the next read or write within a file. This example assumes
|
|
|
For files opened in Random mode, Seek sets the next record.
|
For files opened in modes other than Random mode, Seek sets the byte position at which the next operation takes place. Assume
|
|