[Haskell-cafe] Re: exitFailure under forkProcess

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Wed Oct 27 12:45:30 EDT 2004


John Goerzen <jgoerzen at 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 at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Haskell-Cafe mailing list