delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/09/23:56:59

Date: Mon, 9 Mar 1998 15:49:12 -0800 (PST)
Message-Id: <199803092349.PAA11526@adit.ap.net>
Mime-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Pipes and how to seek
Cc: viking AT caverock DOT net DOT nz, djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019