[Haskell-cafe] hPutStrLn and hFlush

Gracjan Polak gracjanpolak at gmail.com
Mon Jan 9 10:57:51 EST 2006


Hi all,

A bit strange behaviour with hPutStrLn. Consider following program:

main = do
    handle <- openFile "output.txt" WriteMode
    hPutStrLn handle (unlines contLines2)
    -- hFlush houtput
    where
        contLines2 = flip map [1..2000] $
              \x -> show x ++ " been there done that"

Outputs file which ends with following lines:

1989 been there done that
1990 been there done that
1991 been there done that
1992 been there done that
199
(END)

So the output is truncated. When I uncomment hFlush, file is fully written.
Is this expected/documented behaviour?

Platform: WinXP, GHC version 6.4.1

--
Regards,
Gracjan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/haskell-cafe/attachments/20060109/f118ea7b/attachment.htm


More information about the Haskell-Cafe mailing list