From: dbe@wgn.net ($Bill Luebkert)
Subject: Re: I/O redirection of binary data
12 Sep 1998 03:21:30 -0700
Message-ID: <35F9CE3B.DD2644BA.cygnus.gnu-win32@wgn.net>
References: <199809110932.LAA13319@geologi.uio.no>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: Paul Wessel <pal.wessel@geologi.uio.no>
Cc: gnu-win32@cygnus.com

Paul Wessel wrote:
> 
> Hi gnu-win32 experts-
> 
> POSIX recommends that one could use the b(inary) modifier
> in fopen for portability since the b has no effect on POSIX
> systems but may be needed in, say, MS-DOS.  How can
> I deal with this in redirection?  I often have a program do
> 
> program > data
> 
> and data is supposed to be binary but under gnu-win32 I noticed
> that the file size is incorrect (it is larger probably due to CR/LFs?)
> compared to POSIX systems.  This also causes problems when
> trying to read the file with anotherprogram < data.
> Are there any non-intrusive solutions?  WHen using stdout I am
> not using fopen so I cannot easily use the binary flag...

Maybe do isatty() and if not a tty, use binary, else use text mode.

-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
 (_/   /  )    // //       DBE Collectibles
  / ) /--<  o // //      Mailto:dbe@wgn.net
-/-' /___/_<_</_</_    http://www.wgn.net/~dbe/
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
