
24 Oct
2006
24 Oct
'06
4:39 p.m.
Hi
> getChar doesn't return until I press Enter. I need something that > returns immediately after I press any key.
It's a problem with buffering:
hSetBuffering stdin NoBuffering
This usually doesn't work on Windows:
GHC 6.4.2 and 6.6: requires <enter> Hugs (console) Sept. 2006: requires <enter> WinHugs (GUI) Sept. 2006: works as expected
But it seems to work on Linux: GHC 6.4.1 on Ubuntu 6.06: works as expected GHC 6.6 on Ubuntu 6.06: works as expected
I am really interested in hearing of a solution that works on all platforms.
Does 'readKey', from System.Console.Readline, works on Windows? It works on Linux with the buffering advice applied. Maurício