Positioning a sequential file

SYNTAX

seek #channel, position

Positions a sequential file to a specified position, relative to the start of the file. This file position will be used by the next put[field] # or get[field] # command on the sequential file.

#channel

The channel number must be an integer expression in the range 1-64. It is the number that was allocated to the file when it was opened (using open #). It may be a constant, field name or expression. An invalid channel number is ignored.

position

An integer value defining the position required. The beginning of the file is position 0. The built-in function tell() returns the current position of a sequential file.

The position may be any expression that evaluates to an integer value.


NOTES

  • The rewind # and wind # commands position a file at the beginning and end respectively.

  • If the channel is closed the command is ignored.

  • Seeking to a position past the end of the file is not generally recommended, but is allowed. Subsequent behaviour is operating system dependent.


EXAMPLE

open #3 "seqfile" read
seek #3, 256

RELATED TOPICS

tell()

open #

rewind #

wind #

fseek

frewind

Sequential files

Traps