<p><font face="courier new,monospace">module Main(main) where<br>import System.IO</font></p>
<p><font face="courier new,monospace">main = do<br> b1 <- hGetBuffering stdin<br> print b1<br> b2 <- hGetBuffering stdout<br> print b2</font></p>
<p><font face="courier new,monospace"> -- not sure if these help, or are needed<br> hSetBuffering stdin NoBuffering<br> hSetBuffering stdout NoBuffering</font></p>
<p><font face="courier new,monospace"> b1 <- hGetBuffering stdin<br> print b1<br> b2 <- hGetBuffering stdout<br> print b2</font></p>
<p><font face="courier new,monospace"> putStr "0"<br> c <- getChar -- echoes during input by default<br> putStr "1" -- want this output w/o hitting Enter<br> hFlush stdout -- adding this does not help
<br> putStrLn [c]</font></p>
<p><font face="courier new,monospace">{------------------- Output:<br>E:\ghcTest>ghc --version<br>The Glorious Glasgow Haskell Compilation System, version 6.8.1</font></p>
<p><font face="courier new,monospace">E:\ghcTest>ghc --make main<br>[1 of 1] Compiling Main ( main.hs, main.o )<br>Linking main.exe ...</font></p>
<p><font face="courier new,monospace">E:\ghcTest>main<br>LineBuffering<br>LineBuffering<br>NoBuffering<br>NoBuffering<br>0a<br>1a</font></p>
<p><font face="courier new,monospace">E:\ghcTest></font></p>
<div><font face="courier new,monospace">----------------- Question:<br></font><font face="courier new,monospace"></font></div>
<div><font face="courier new,monospace">Is it possible to have unbuffered character IO under <br>Windows XP?</font></div>
<p><font face="courier new,monospace">I would like to be able to type a single character and have <br>the processing and IO continue without having to hit Enter.</font></p>
<p><font face="courier new,monospace">I.e., rather than this <br>(had to hit Enter after typing the 'a' in '0a'):<br>0a<br>1a</font></p>
<p><font face="courier new,monospace">I would like to have this <br>(without having to hit Enter after typing the char):<br>0a1a</font></p>
<p><font face="courier new,monospace">I have tried a few combinations of hSetBuffering and <br>put/get Str/Char functions, without success.</font></p>
<p><font face="courier new,monospace">NOTE:<br>I need to run under Windows XP, non-administrator account.<br>This test was run using the normal XP shell cmd.exe.</font></p>
<div><font face="courier new,monospace">Thanks much in advance.<br>-- Peter<br>--------}</font></div>
<div><font face="courier new,monospace"></font> </div>