Go to the first, previous, next, last section, table of contents.


CNPipe -- Unix Pipe

SYNOPSIS

#include <CNCL/Pipe.h>

TYPE

CN_PIPE

BASE CLASSES

CNObject

DERIVED CLASSES

None

RELATED CLASSES

None

DESCRIPTION

CNPipe creates and manages Unix I/O pipes between two programs, thus that two cooperating processes can transfer data.

Constructors:

CNPipe();
CNPipe(CNParam *param);
CNPipe(const CNString& prog);
Initializing the pipe. If the program name prog is set, the pipe will be opened immediately. Otherwise the open() command has to be used when needed. The destructor closes the pipe if it was not closed before.


In addition to the member functions required by CNCL, CNPipe provides:

int open(const CNString& prog);
Opens the pipe to the program. If the pipe already exists, the old pipe will be closed before opening the new one. The returned integer value indicates the success of the opening process. If successful 0 is returned, otherwise an error message is shown and -1 is returned.
int close();
Closes an existing pipe. If an error occurs, -1 is returned, otherwise a 0.
ostream & out();
istream & in ();
Returns the input/output stream.
int fd_in();
int fd_out();
Returns the I/O pipe file descriptors.
int get_pid();
Returns the program's PID.


Go to the first, previous, next, last section, table of contents.