ex36.pp 552 B

1234567891011121314151617181920212223242526
  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 ('Writing to pipe, and flushing.');
  12. Writeln (pipo,'This is a textstring');close(pipo);
  13. Writeln ('Reading from pipe.');
  14. While not eof(pipi) do
  15. begin
  16. Readln (pipi,s);
  17. Writeln ('Read from pipe : ',s);
  18. end;
  19. close (pipi);
  20. writeln ('Closed pipes.');
  21. writeln
  22. end.