Pipes to C++ Streams
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 >> ins开发者_如何学JAVAtead of read() and write()
thanks in advance
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
Check out http://www.netbsd.org/~jmmv/process/ and http://www.highscore.de/boost/process/
EDIT http://svn.boost.org/svn/boost/sandbox/process/
I forget which one hosts the latest source, but it's a very good cross-platform IPC library with support for pipes.
It's not actually part of boost but they want (or wanted) it to be.
精彩评论