[Haskell-cafe] Re: Read a single char

Maurí­cio briqueabraque at yahoo.com
Tue Oct 24 16:39:23 EDT 2006


> 
>     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



More information about the Haskell-Cafe mailing list