I was told that if I used fprint or fwrite to output to the parent-to-child command pipeline, it might not be on the actual pipe when I do a read of the child.
How can this happen? Can someone give me an example?
This is a discussion on fwrite over pipes question within the Linux Programming forums, part of the Platform Specific Boards category; I was told that if I used fprint or fwrite to output to the parent-to-child command pipeline, it might not ...
I was told that if I used fprint or fwrite to output to the parent-to-child command pipeline, it might not be on the actual pipe when I do a read of the child.
How can this happen? Can someone give me an example?
Well there might be a timing issue, but whatever you write should be read eventually.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.
How could there be a timing issue with fwrite() and not with write()?
fwrite() is buffered because it uses stdio. write() is a system call that directly writes to the file in question via the file descriptor, and not a FILE object via its buffer.