[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Read a null-terminated string from the stream.
Source position: objects.pp line 279
function TStream.StrRead: PChar; |
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.
On error, Nil is returned.
|
Write a null-terminated string to the stream. |
|
|
Read a shortstring from the stream. |
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.
lazarus-ccr.sourceforge.net |