27 Oct
2004
27 Oct
'04
4:45 p.m.
John Goerzen <jgoerzen@complete.org> writes:
I wonder what the behavior of fwrite() in this situation is. I don't know if it ever performs buffering such that write() is never called during a call to fwrite().
On Linux it duplicates unflushed output (hmm, I thought they fixed this a few years ago). X/Open specification doesn't say anything about this. #include <stdio.h> #include <unistd.h> int main() { printf("1 "); fflush(stdout); printf("2 "); fork(); printf("3\n"); } Output: 1 2 3 2 3 In C you cay say fflush(NULL) to flush all open output streams. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/