[Overview][Types][Classes][Index] | Reference for unit 'iostream' (#fcl)

# TIOStream.Seek

Set the stream position

## Declaration

Source position: iostream.pp line 35

`public function TIOStream.Seek(`
`Offset: LongInt;`
`Origin: Word`
`):LongInt; override;`

## Arguments

`Offset` |  | Byte offset to position the stream on
`Origin` |  | Where to start the byte offset

## Function result

New position of the stream.

## Description

Seek overrides the standard Seek implementation. Normally, standard input, output and stderr are not seekable. The TIOStream stream tries to provide seek capabilities for the following limited number of cases:

Origin=soFromBeginning
  If Offset is larger than the current position, then the remaining bytes are skipped by reading them from the stream and discarding them, if the stream is of type iosInput.
Origin=soFromCurrent
  If Offset is zero, the current position is returned. If it is positive, then Offset bytes are skipped by reading them from the stream and discarding them, if the stream is of type iosInput.

All other cases will result in a EIOStreamError exception.

## Errors

An EIOStreamError exception is raised if the stream does not allow the requested seek operation.

## See also

EIOStreamError |  | Error thrown in case of an invalid operation on a TIOStream.

The latest version of this document can be found at lazarus-ccr.sourceforge.net .