
1 Jan
2006
1 Jan
'06
12:10 p.m.
Cale Gibbard wrote:
You shouldn't have to flush output manually. Which implementation are you using? Try importing System.IO and doing: hGetBuffering stdout >>= print and see what gets printed. It should be "NoBuffering".
The buffering for stdout should be LineBuffering if stdout is a terminal and BlockBuffering otherwise. The buffering for stderr should always be NoBuffering.
If for whatever reason it's not, you can set it to that at the start of your programs with hSetBuffering stdout NoBuffering
I would suggest using an explit hFlush after each putStr rather than
disabling buffering altogether, as disabling buffering will result in
putStr etc calling write() once per character, which is very
inefficient.
--
Glynn Clements