delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/02/25/21:58:06

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <199902260257.UAA08616@modi.xraylith.wisc.edu>
X-Authentication-Warning: modi.xraylith.wisc.edu: localhost.xraylith.wisc.edu [127.0.0.1] didn't use HELO protocol
To: "Pierre A. Humblet" <Pierre DOT Humblet AT eurecom DOT fr>
cc: "E. Robert Tisdale" <edwin AT netwood DOT net>, cygwin AT sourceware DOT cygnus DOT com
Subject: Re: setmode (long)
In-reply-to: Your message of "Thu, 25 Feb 1999 21:50:15 EST."
<3 DOT 0 DOT 5 DOT 32 DOT 19990225215015 DOT 00857270 AT pop DOT ne DOT mediaone DOT net>
Date: Thu, 25 Feb 1999 20:57:17 -0600
From: Mumit Khan <khan AT xraylith DOT wisc DOT EDU>

"Pierre A. Humblet" <Pierre DOT Humblet AT eurecom DOT fr> writes:
> At 12:09 PM 2/25/99 -0800, E. Robert Tisdale wrote:
> Robert,
> 
> As I said, at least on my machine, od -c shows all lines of test.out ending w
> ith \r \n. Now when I modify your program end remove the third setmode, which
>  switches back to TEXT, then all lines appear in binary mode!
> Here is a possible explanation: your program is not flushing the buffer and t
> he "effective" mode is the last one, at the time data is moved to disk.
> stdout is flushed more often, that's why it works.
> 

I believe Pierre has something here. I took another look at your code, and
you're changing the mode of a buffered stream! Could you flush the
stream (stream << flush) before changing the mode and see what happens?

I don't believe that your code is well-defined, since changing anything
for an underlying descriptor of a buffered stream without flushing is
not guaranteed to produce the desired effect.

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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