Mail Archives: djgpp/1998/03/09/23:56:59
At 02:22 3/8/1998 +0200, Eli Zaretskii wrote:
>
>On Sat, 7 Mar 1998, Nate Eldredge wrote:
>
>> setmode(fileno(stdin), O_BINARY);
>
>A better way is to say this:
>
> if (!isatty(fileno(stdin)))
> setmode(fileno(stdin), O_BINARY);
>
>IMHO, you should avoid setting the console to binary mode at all
>costs, since this have some nasty side-effects (e.g., you cannot
>interrupt a runaway program with Ctrl-C).
Thanks for the enlightenment. I never thought of that.
> In my experience, it is
>never really needed anyway: if binary garbage is being sent to the
>screen, who cares if it gets truncated?
Well... A defensive enough program might (case in point: the ENOSPC errors
from `grep'). But you're right.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -