[Overview][Types][Classes] 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

Seekoverrides the standard Seekimplementation. Normally, standard input, output and stderr are not seekable. The TIOStreamstream tries to provide seek capabilities for the following limited number of cases:

Origin=soFromBeginning
If Offsetis 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 Offsetis zero, the current position is returned. If it is positive, then Offsetbytes 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 EIOStreamErrorexception.

Errors

An EIOStreamErrorexception 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.