TStream.ReadStr function
Read a shortstring from the stream.
Declaration
function ReadStr: PStringDescription
ReadStr reads a string from the stream, copies it to the heap
and returns a pointer to this copy. The string is saved as a pascal
string, and hence is NOT null terminated.Errors
On error (e.g. not enough memory),
Nil is returned.
See also
Example: ex13
Program ex13;
{
Program to demonstrate the TStream.ReadStr TStream.WriteStr functions
}
Uses objects;
Var P : PString;
L : String;
S : PStream;
begin
L:='Constant string line';
Writeln ('Writing to stream : "',L,'"');
S:=New(PMemoryStream,Init(100,10));
S^.WriteStr(@L);
S^.Seek(0);
P:=S^.ReadStr;
L:=P^;
DisposeStr(P);
DisPose (S,Done);
Writeln ('Read from stream : "',L,'"');
end.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
