[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Read a shortstring from the stream.
Source position: objects.pp line 282
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.
On error (e.g. not enough memory), Nil is returned.
|
Read a null-terminated string from the stream. |
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.
lazarus-ccr.sourceforge.net |