[Haskell-cafe] Strange console IO behavior (at least on Windows)
bugfact at gmail.com
Sat Aug 22 17:14:00 EDT 2009
The following program
should echo the ASCII code of each character the user types, on the fly,
with no line buffering whatsoever.
But it doesn't. At least not under Windows's cmd, and even less with msys.
Under Windows, I have to press enter before anything is printed to the
screen. It then always prints 71 (that's upper G, no idea where that comes
from), and then blocks. Pressing enter again prints the codes of all
characters typed, except the first one, following by the two codes of the
linefeeds. So e.g. when I type "abc" ENTER, I get 71, then hitting ENTER
again, I get 98 99 10 10.
Under msys, it just ignores both the hSetBuffering and hSetEcho, but when
hitting enter, it at least prints the codes correctly.
How does it behave under OSX and Linux? Is this a bug or am I doing
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe