[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Classes' (#rtl)

TStream.Seek

Sets the current position in the stream

Declaration

Source position: classesh.inc line 951

public function TStream.Seek(

  Offset: LongInt;

  Origin: Word

):LongInt; virtual; overload;

function TStream.Seek(

  const Offset: Int64;

  Origin: TSeekOrigin

):Int64; virtual; overload;

Description

Seek sets the position of the stream to Offset bytes from Origin. There is a 32-bit variant of this function and a 64-bit variant. The difference can be made by choosing the correct Offset parameter: the integer-typed parameter selects the 32-bit variant, the parameter of type TSeekOrigin selects the 64-bit variant of the function.

The Origin parameter for the 32-bit version can have one of the following values:

Constant Meaning
soFromBeginning Set the position relative to the start of the stream.
soFromCurrent Set the position relative to the current position in the stream.
soFromEnd Set the position relative to the end of the stream.

These values are defined in the SysUtils unit.

The Origin parameter for the 64-bit version has one of the following values:

Value Meaning
soBeginning Offset is interpreted relative to the start of the stream.
soCurrent Offset is interpreted relative to the current position in the stream.
soEnd Offset is interpreted relative to the end of the stream.

Offset should be negative when the origin is SoFromEnd (soEnd). It should be positive for soFromBeginning and can have both signs for soFromCurrent

This is an abstract method, which must be overridden by descendant classes. They may choose not to implement this method for all values of Origin and Offset.

Remark: Internally, all calls are re-routed to the 64-bit version of the call. When creating a descendant of TStream, the 64-bit version of the call should be overridden.

Errors

An exception may be raised if this method is called with an invalid pair of Offset,Origin values. e.g. a negative offset for soFromBeginning (or soBeginning).

See also

TStream.Position

  

The current position in the stream.


Documentation generated on: May 14 2021