Unit 'Objects' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]

TStream.GetSize

Return the size of the stream.

Declaration

Source position: objects.pp line 316

function TStream.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

TStream.Seek

  

Set stream position.

TStream.GetPos

  

Return current position in the stream.

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.    

Documentation generated on: Jul 24 2023