[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'BaseUnix' (#rtl)

FpPipe

Create a set of pipe file handlers

Declaration

Source position: bunxh.inc line 37

function FpPipe(

  var fildes: TFilDes

):cint;

Description

FpPipe creates a pipe, i.e. two file objects, one for input, one for output. The filehandles 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 succesfully, 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

#rtl.unix.POpen

  

Pipe file to standard input/output of program

fpMkFifo

  

Create FIFO (named pipe) in file system

Example

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.

Documentation generated on: Nov 16 2015