StreamToString function
Return to Introduction  Previous page  Next page
Unit
acUtils  

Declaration
function StreamToString(Stream: TStream): String;  

Description
The StreamToString function converts the content of the stream to a string. It determines the size of future string by stream size and put full content of stream to a string.  

Original code
function StreamToString(Stream: TStream): String;  
var  
  Len: DWord;  
begin  
  with Stream do  
   begin  
    Len := Size - Position;  
    SetLength(Result, Len);  
    Read(Result[1], Len);  
   end;  
end;  

See also
PutStringToStream and GetStringFromStream routines.