On 10/23/06, <b class="gmail_sendername">Neil Mitchell</b> <<a href="mailto:email@example.com">firstname.lastname@example.org</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br><br>> getChar doesn't return until I press Enter. I need something that<br>> returns immediately after I press any key.<br><br>It's a problem with buffering:<br><br>hSetBuffering stdin NoBuffering</blockquote>
<div><br>This usually doesn't work on Windows:<br><br>GHC 6.4.2 and 6.6: requires <enter><br>Hugs (console) Sept. 2006: requires <enter><br>
WinHugs (GUI) Sept. 2006: works as expected<br><br>But it seems to work on Linux:<br>GHC 6.4.1 on Ubuntu 6.06: works as expected<br>GHC 6.6 on Ubuntu 6.06: works as expected<br><br>I am really interested in hearing of a solution that works on all platforms.
<br><br>> import IO<br>> main = do<br>> hSetBuffering stdin NoBuffering<br>> hGetChar stdin<br><br>Regards,<br>Brian <br></div><br></div>