Date: Mon, 9 Mar 1998 15:49:12 -0800 (PST) Message-Id: <199803092349.PAA11526@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: Eli Zaretskii From: Nate Eldredge Subject: Re: Pipes and how to seek Cc: viking AT caverock DOT net DOT nz, djgpp AT delorie DOT com Precedence: bulk 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