GetStringFromStream
|
![]() ![]() ![]() |
acUtils
|
function GetStringFromStream: String;
|
The GetStringFromStream function retrieves the string from current position of stream. It determines the size of string by first 4 bytes read from stream. This function should be used to get the string, if the string was put to stream with PutStringToStream procedure.
|
function GetStringFromStream(Stream: TStream): String;
|
var
|
Len: DWord;
|
begin
|
with Stream do
|
try
|
Read(Len, SizeOf(Len));
|
{ check whether the stream really contain the line with such length }
|
if Size - Position >= Len then
|
begin
|
SetLength(Result, Len);
|
Read(Result[1], Len);
|
end
|
else Result := '';
|
except
|
end;
|
end;
|
GetStringFromStream function.
|