HSetBuffering is what you're looking for, the default (on Unix at least) is line buffering. Use it on the stdin before starting the main loop.
Up vote 2 down vote favorite share g+ share fb share tw.
I am writing a program that runs an external sub process interactively and I need the contents of the output handle to be output to stdout as soon as it is available. I have tried something like this: main = do processInfo do mainloop hIn hOut hClose hIn hClose hOut _ -> do error "Unable to start process" mainloop :: Handle -> Handle -> IO () mainloop inh outh = do ineof I have read through the documentation of both System. Process and System.
IO and haven't really found anything conclusive. Haskell io monads link|improve this question asked Mar 22 '09 at 21:02devonrt724 75% accept rate.
HSetBuffering is what you're looking for, the default (on Unix at least) is line buffering. Use it on the stdin before starting the main loop hSetBuffering hIn NoBuffering and optionally also on the output handle if you want to see the results immediately on the output side. Note, however, that disabling buffering can quite drastically decrease performance.
Thank you, I didn't even think of changing the buffering mode on stdin/stdout. – devonrt Mar 24 '09 at 10:19 It's worth noting that the default on Windows is different to the default on Linux so it's worth setting the buffering type anyway to get consistent behaviour. – Porges May 11 '09 at 11:54.
I'm very much a Haskell newbie, but I remember coming across an example recently of processing input character-by-character. Is hSetBuffering possibly what you are looking for?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.