module Main(main) where
import System.IOmain = do
b1 <- hGetBuffering stdin
print b1
b2 <- hGetBuffering stdout
print b2-- not sure if these help, or are needed
hSetBuffering stdin NoBuffering
hSetBuffering stdout NoBufferingb1 <- hGetBuffering stdin
print b1
b2 <- hGetBuffering stdout
print b2putStr "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.1E:\ghcTest>ghc --make main
[1 of 1] Compiling Main ( main.hs, main.o )
Linking main.exe ...E:\ghcTest>main
LineBuffering
LineBuffering
NoBuffering
NoBuffering
0a
1aE:\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
1aI would like to have this
(without having to hit Enter after typing the char):
0a1aI 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