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.
精彩评论