
I have this problem as well and would love to hear if there is an answer.
I think there are some windows terminal settings that the GHC runtime should
twiddle when you change the buffering state on stdin, but I don't know
exactly what is involved.
-- ryan
On 12/28/07, Peter Schmitz
module Main(main) where import System.IO
main = do b1 <- hGetBuffering stdin print b1 b2 <- hGetBuffering stdout print b2
-- not sure if these help, or are needed hSetBuffering stdin NoBuffering hSetBuffering stdout NoBuffering
b1 <- hGetBuffering stdin print b1 b2 <- hGetBuffering stdout print b2
putStr "0" c <- getChar -- echoes during input by default putStr "1" -- want this output w/o hitting Enter hFlush stdout -- adding this does not help putStrLn [c]
{------------------- Output: E:\ghcTest>ghc --version The Glorious Glasgow Haskell Compilation System, version 6.8.1
E:\ghcTest>ghc --make main [1 of 1] Compiling Main ( main.hs, main.o ) Linking main.exe ...
E:\ghcTest>main LineBuffering LineBuffering NoBuffering NoBuffering 0a 1a
E:\ghcTest> ----------------- Question: Is it possible to have unbuffered character IO under Windows XP?
I would like to be able to type a single character and have the processing and IO continue without having to hit Enter.
I.e., rather than this (had to hit Enter after typing the 'a' in '0a'): 0a 1a
I would like to have this (without having to hit Enter after typing the char): 0a1a
I have tried a few combinations of hSetBuffering and put/get Str/Char functions, without success.
NOTE: I need to run under Windows XP, non-administrator account. This test was run using the normal XP shell cmd.exe. Thanks much in advance. -- Peter --------}
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe