Hi all,

How to read one char from stdin and return immediately?
I mean there is no need to wait the user input a return.

For example:
Print "y/n: "
Users input y, return immediately, no return need.

I have tried code as below, but it didn't work for me.

import IO

main = do
         hSetBuffering stdout NoBuffering            
         putStr   "Y/N: "
         c <- getChar
         putStr ("Your input is " ++ show c++".\n")

Thanks very much.

Best regards,
Haihua Lin


_______________________________________________
Haskell mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to