Sign in Join
FPDoc Onlineexperiment

TStream.GetSize function

Member of TStreamIn unit Objects

Return the size of the stream.

Declaration

pascal
function GetSize: LongInt; virtual

Description

If the stream's status is stOk then GetSize returns the size of the stream, otherwise it returns -1.

Errors

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

See also

Example: ex12

pascal
Program ex12;

{ Program to demonstrate the TStream.GetSize function }

Uses objects;

Var L : String;
    S : PStream;

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

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