TStream.StrRead function
Read a null-terminated string from the stream.
Declaration
function StrRead: PAnsiCharDescription
StrRead reads a string from the stream, allocates memory
for it, and returns a pointer to a null-terminated copy of the string
on the heap.Errors
On error,
Nil is returned.
See also
Example: ex10
Program ex10;
{
Program to demonstrate the TStream.StrRead TStream.StrWrite functions
}
Uses objects;
Var P : PChar;
S : PStream;
begin
P:='Constant Pchar string';
Writeln ('Writing to stream : "',P,'"');
S:=New(PMemoryStream,Init(100,10));
S^.StrWrite(P);
S^.Seek(0);
P:=Nil;
P:=S^.StrRead;
DisPose (S,Done);
Writeln ('Read from stream : "',P,'"');
Freemem(P,Strlen(P)+1);
end.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
