Skip to content

Seek Function

Paul Squires edited this page Oct 19, 2026 · 2 revisions

Home › File I/O Functions › Seek (Function)

Seek (Function)

Returns the 1-based position of the next read or write: bytes, or records for Random.

Syntax

Declare Function Seek ( ByVal filenum As Long ) As LongInt

Parameters

  • filenum

Description

The position is given in records if the file was opened in Random access mode, in bytes in any other case. The file position returned is 1-based, so the first record of a file is 1.

The Seek statement is used to set the position of the next read or write operation.

Return Value

The file position where the next read or write operation will take place.

Remarks

Differences from QB

  • None

See also

Examples

Dim f As Long, position As LongInt

f = FreeFile

Open "file.ext" For Binary As #f

position = Seek(f)

Close #f

Category: File I/O Functions
Kind: function


Reproduced from the FreeBASIC Wiki Manual under the GNU Free Documentation License 1.3 — with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. Copyright © the FreeBASIC project and wiki contributors. See License.

Clone this wiki locally