开发者

Read from unix pipe when there's no one to write to it. (C++)

If I spawn a child and pass him a pipe, the child writes to the output of the pipe(to the parent) and after that the chil开发者_运维百科d dies. Can the parent read from the pipe what the child had written before it died? Thanks. (ps: I'm talking about C++)


Yes, but watch for the buffer space: if the parent is not yet reading, the child will not be able to write more than the buffer size, which is different from system to system, 16k on mine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜