ex36.pp 621 B

12345678910111213141516171819202122232425262728
  1. Program Example36;
  2. { Program to demonstrate the AssignPipe function. }
  3. Uses linux;
  4. Var pipi,pipo : Text;
  5. s : String;
  6. begin
  7. Writeln ('Assigning Pipes.');
  8. assignpipe(pipi,pipo);
  9. if linuxerror<>0 then
  10. Writeln('Error assigning pipes !');
  11. Writeln ('Rewrite Output pipe');
  12. rewrite (pipo);
  13. Writeln ('Reset Input pipe ');
  14. reset (pipi);
  15. Writeln ('Writing to pipe, and flushing.');
  16. Writeln (pipo,'This is a textstring');flush(pipo);
  17. Writeln ('Reading from pipe.');
  18. Readln (pipi,s);
  19. Writeln ('Read from pipe : ',s);
  20. close (pipo);
  21. close (pipi);
  22. writeln ('Closed pipes.');
  23. writeln
  24. end.