<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>&nbsp;&nbsp; b1 &lt;- hGetBuffering stdin<br>&nbsp;&nbsp; print b1<br>&nbsp;&nbsp; b2 &lt;- hGetBuffering stdout<br>&nbsp;&nbsp; print b2</font></p>
<p><font face="courier new,monospace">&nbsp;&nbsp; -- not sure if these help, or are needed<br>&nbsp;&nbsp; hSetBuffering stdin&nbsp; NoBuffering<br>&nbsp;&nbsp; hSetBuffering stdout NoBuffering</font></p>
<p><font face="courier new,monospace">&nbsp;&nbsp; b1 &lt;- hGetBuffering stdin<br>&nbsp;&nbsp; print b1<br>&nbsp;&nbsp; b2 &lt;- hGetBuffering stdout<br>&nbsp;&nbsp; print b2</font></p>
<p><font face="courier new,monospace">&nbsp;&nbsp; putStr &quot;0&quot;<br>&nbsp;&nbsp; c &lt;- getChar&nbsp;&nbsp; -- echoes during input by default<br>&nbsp;&nbsp; putStr &quot;1&quot;&nbsp;&nbsp;&nbsp;&nbsp; -- want this output w/o hitting Enter<br>&nbsp;&nbsp; hFlush stdout&nbsp; -- adding this does not help
<br>&nbsp;&nbsp; putStrLn [c]</font></p>
<p><font face="courier new,monospace">{------------------- Output:<br>E:\ghcTest&gt;ghc --version<br>The Glorious Glasgow Haskell Compilation System, version 6.8.1</font></p>
<p><font face="courier new,monospace">E:\ghcTest&gt;ghc --make main<br>[1 of 1] Compiling Main&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( main.hs, main.o )<br>Linking main.exe ...</font></p>
<p><font face="courier new,monospace">E:\ghcTest&gt;main<br>LineBuffering<br>LineBuffering<br>NoBuffering<br>NoBuffering<br>0a<br>1a</font></p>
<p><font face="courier new,monospace">E:\ghcTest&gt;</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 &#39;a&#39; in &#39;0a&#39;):<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>&nbsp;</div>