[Overview][Constants][Types][Procedures and functions][Variables] |
Create a set of pipe file handlers
Source position: line 0
function AssignPipe( |
var pipe_in: LongInt; |
var pipe_out: LongInt |
):Boolean; |
var pipe_in: text; |
var pipe_out: text |
):Boolean; |
var pipe_in: ; |
var pipe_out: |
):Boolean; |
AssignePipecreates a pipe, i.e. two file objects, one for input, one for output. What is written to Pipe_out, can be read from Pipe_in.
This call is overloaded. The in and out pipe can take three forms: an typed or untyped file, a text file or a file descriptor.
If a text file is passed then reading and writing from/to the pipe can be done through the usual Readln(Pipe_in,...)and Writeln(Pipe_out,...)procedures.
The function returns Trueif everything went succesfully, Falseotherwise.
In case the function fails and returns False, LinuxErroris used to report errors:
|
Pipe file to standard input/output of program |
|
|
Create FIFO (named pipe) in file system |
Program Example36; { Program to demonstrate the AssignPipe function. } Uses oldlinux; Var pipi,pipo : Text; s : String; begin Writeln ('Assigning Pipes.'); If Not assignpipe(pipi,pipo) then Writeln('Error assigning pipes !',LinuxError); Writeln ('Writing to pipe, and flushing.'); Writeln (pipo,'This is a textstring');close(pipo); Writeln ('Reading from pipe.'); While not eof(pipi) do begin Readln (pipi,s); Writeln ('Read from pipe : ',s); end; close (pipi); writeln ('Closed pipes.'); writeln end.