Sounds like you have unflushed buffered output into the pipe; use fflush() to force it into the pipe without closing the stream. It should never be necessary to close a pipe for its data to be made available to the reader.