FpPipe function
Create a set of pipe file handlers.
Declaration
function FpPipe(var fildes: TFilDes): cintDescription
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.
Errors
In case the function fails, the following return values are possible:
- sys_emfile
- Too many file descriptors for this process.
- sys_enfile
- The system file table is full.
See also
Example: ex36
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.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
