[Haskell-cafe] How to getCh on MS Windows command line?

Bayley, Alistair Alistair.Bayley at invesco.com
Mon Nov 10 09:27:25 EST 2008

> From: glasgow-haskell-users-bounces at haskell.org 
> [mailto:glasgow-haskell-users-bounces at haskell.org] On Behalf 
> Of Simon Marlow
> Bulat Ziganshin wrote:
> > 흐壹o 鉅,
> > 
> > 工賊嫂, 膠墮將奄 굅, 껐갭, 맏굡별9 죌, 闔u 破訂佯
> Please stick to English on this list, thanks.
> Simon

Actualy it was english, it's just that the encoding was wrong. In Outlook I manually changed the encoding to US-ASCII, and got the message below. I'm not sure why other 8-bit encoding options failed (like Western Europen (ISO).


Hello Ki,

Monday, November 10, 2008, 8:16:09 AM, you wrote:

> What I mean by getCh is the non-buffered non-echoed version of getChar,
> which Hugs used to provided as an extension but not any more.

1. works for me in ghc:

getHiddenChar = liftM (chr.fromEnum) c_getch
foreign import ccall unsafe "conio.h getch"
   c_getch :: IO CInt

2. setBufferingMode stdin NoBuffering

not tested

3. use interact. i definitely remember that i had effect you need this
way. probably it was with some hugs version, but i don't remeber

4. these days it's not very hard to install free VMWare Player, get
preinstalled linux image and install hugs/ghc there

Best regards,
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.

More information about the Glasgow-haskell-users mailing list