[Haskell-cafe] Re: Re: Read a single char

Ross Paterson ross at soi.city.ac.uk
Wed Oct 25 13:08:07 EDT 2006


On Wed, Oct 25, 2006 at 06:57:38PM +0200, Hans van Thiel wrote:
>         Yes, but the problem is with two subsequent runs of main. I'd
>         have thought the buffer would flush automatically and the second
>         run would start with an empty buffer. Now I enter 'b', then
>         press 'Enter' and it works as expected. Then I 'main' again, and
>         it terminates right away with a blank line.

That is normal Unix behaviour.  Try the same input with

	head -1c | od -c; head -1c | od -c

The terminal buffer is only discarded if a program changes the terminal
mode.  Hugs and ghci do (because they use readline), but runhugs doesn't.



More information about the Haskell-Cafe mailing list