[Overview][Constants][Types][Procedures and functions][Index] |
Create a set of pipe file handlers
Source position: bunxh.inc line 37
function FpPipe( |
var fildes: TFilDes |
):cint; |
FpPipe creates a pipe, i.e. two file objects, one for input, one for output. The file handles are returned in the array fildes. The input handle is in the 0-th element of the array, the output handle is in the 1-st element.
The function returns zero if everything went successfully, a nonzero return value indicates an error.
In case the function fails, the following return values are possible:
|
Pipe file to standard input/output of program |
|
|
Create FIFO (named pipe) in file system |
Program Example36; { Program to demonstrate the AssignPipe function. } Uses BaseUnix,Unix; Var pipi,pipo : Text; s : String; begin Writeln ('Assigning Pipes.'); If assignpipe(pipi,pipo)<>0 then Writeln('Error assigning pipes !',fpgeterrno); 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.