is it possible to turn pipes genereated via pipe() on a POSIX-system into std::istreams and std::ostreams? if yes, how?
i would prefer to use << and >> instead of read() and write()
thanks in advance
A pipe is a system call that creates a unidirectional communication link between two file descriptors. The pipe system call is called with a pointer to an array of two integers.
In most cases, clists and streams are used to implement a portion of the link between a user process (specifically, a file descriptor) and a character device driver (for example, a serial port or a pty). Pipes are also a queue, but they link user processes (specifically, a pair of file descriptors).
A pipe is a communication channel between two processes. It has a writing end and a reading end. When on open one of these two end, one get a (writing or reading) stream. So in a first approximation there is a stream at each end of a pipe.
, that implement the input and output components of a pipe. Pipes are used to channel the output from one program (or thread) into the input of another. Piped input and output streams are convenient for methods that produce output to be used as input by someone else.
There are non-standard constructors which take file descriptor number or FILE*. See http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-api-4.5/a00074.html#a777faeb6849444b4663d1cbe543e1ae3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With