On 5/27/07, Ryan Ingram <[EMAIL PROTECTED]> wrote:
I was hoping that hSetBuffering would turn off the line buffering for stdin,
but it doesn't seem to work.

----
module Main where
import System.IO

main :: IO ()
main = do
    hSetBuffering stdin NoBuffering
    hSetBuffering stdout NoBuffering

    hPutChar stdout '>'
    c <- hGetChar stdin
    hPutChar stdout '<'
----

This program should terminate immediately after the first character is typed
into the terminal, but it waits until I type a newline.  It also looks like
it's using GNU readline (it handles the up & down arrow keys.)

How do I turn this off and use raw character-based IO?  I'm using GHC6.6 on
Win32 if that makes a difference.

Using the same platform but I get essentially the same behavior.  I
too have to type enter to get the program to accept the input, but
then it exits immediately so I don't know how you tested the up and
down arrows.

When I compile this on debian it works as you expected.  Perhaps this
is a windows bug?

Jason
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to