TStream.GetSize

Return the size of the stream.

Declaration

Source position: objects.pp line 316

default 
  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

Name Description
TStream.GetPos Return current position in the stream
TStream.Seek Set stream position.

Example

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.