Sign in Join
FPDoc Onlineexperiment

TStream.GetPos function

Member of TStreamIn unit Objects

Return current position in the stream.

Declaration

pascal
function GetPos: LongInt; virtual

Description

If the stream's status is stOk, GetPos returns the current position in the stream. Otherwise it returns -1

Errors

-1 is returned if the status is an error condition.

See also

Example: ex11

pascal
Program ex11;

{ Program to demonstrate the TStream.GetPos function }

Uses objects;

Var L : String;
    S : PStream;

begin
  L:='Some kind of string';
  S:=New(PMemoryStream,Init(100,10));
  Writeln ('Stream position before write: ',S^.GetPos);
  S^.WriteStr(@L);
  Writeln ('Stream position after write : ',S^.GetPos);
  Dispose(S,Done);
end.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.