2008/2/12 Magnus Therning <[EMAIL PROTECTED]>: > The following code will on Linux print three strings each followed by a NULL > byte: > > module Main where > > putStr0 = putStr $ s ++ "\0" > > main = do > putStr0 "Hello" > putStr0 "Hello" > putStr0 "Hello" > > On Windows however it will print nothing! In order to trigger printing I > have to change the definition of putStr0 to > > putStr0 = putStr (s ++ "\0") >> hFlush stdout > > Is this difference in behaviour due to a bug in GHC on Windows or just a > quirkiness of the platform? > I can't directly answer, but a way to find out would be to try the same thing in C.
It seems to me that, while Linux implicitly flushes streams on exit, Windows is failing to do so. So try the same output in C, with and without fflush, and.. you'll see. A program to do this follows for your convenience. ---- #include <stdio.h> int main() { int i; for (int i=0; i<3; i++) puts("Hello\0"); //fflush(stdout); return 0; } _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe