C++流的管道

5

在POSIX系统中,是否可以将通过pipe()生成的管道转换为std::istreams和std::ostreams?如果可以,如何实现?

我更喜欢使用<<和>>而不是read()和write()

提前感谢。


1
我从未见过有人像那样用连字符连接标识符。我完全赞成。 - Jon Purdy
2个回答

4

1
__gnu_cxx::stdio_filebuf<char> buf(pipe, std::ios::in); iostream output(&buf); __gnu_cxx::stdio_filebuf<char> buf(pipe, std::ios::in); iostream output(&buf); - M3t0r

2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接