ex13.pp 420 B

123456789101112131415161718192021222324
  1. Program ex13;
  2. {
  3. Program to demonstrate the TStream.ReadStr TStream.WriteStr functions
  4. }
  5. Uses objects;
  6. Var P : PString;
  7. L : String;
  8. S : PStream;
  9. begin
  10. L:='Constant string line';
  11. Writeln ('Writing to stream : "',L,'"');
  12. S:=New(PMemoryStream,Init(100,10));
  13. S^.WriteStr(@L);
  14. S^.Seek(0);
  15. P:=S^.ReadStr;
  16. L:=P^;
  17. DisposeStr(P);
  18. DisPose (S,Done);
  19. Writeln ('Read from stream : "',L,'"');
  20. end.