> How should I modify the function below so that characters are printed
> out as they arrive?
> 
> printchar :: Handle -> IO ()
> printchar handle = do   c <- hGetChar handle
>                         putChar c

Try using
    hSetBuffering handle NoBuffering
    hSetBuffering stdout NoBuffering
from the IO library, before you call printchar.  If the input handle
is attached to a terminal, you may also need to adjust the terminal
emulation into `cbreak' mode, e.g. with
    System.system "stty cbreak"
Don't forget to reset the terminal afterwards!

Regards,
    Malcolm
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to