This is the mail archive of the cygwin@sourceware.cygnus.com
mailing list for the Cygwin project. See the Cygwin
home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]
Re: setmode (long)
- To: "Pierre A. Humblet" <Pierre.Humblet@eurecom.fr>
- Subject: Re: setmode (long)
- From: Mumit Khan <khan@xraylith.wisc.EDU>
- Date: Thu, 25 Feb 1999 20:57:17 -0600
- cc: "E. Robert Tisdale" <edwin@netwood.net>, cygwin@sourceware.cygnus.com
- Delivered-To: listarch-cygwin@sourceware.cygnus.com
- Delivered-To: mailing list cygwin@sourceware.cygnus.com
- In-reply-to: Your message of "Thu, 25 Feb 1999 21:50:15 EST." <3.0.5.32.19990225215015.00857270@pop.ne.mediaone.net>
- Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
- Sender: cygwin-owner@sourceware.cygnus.com
"Pierre A. Humblet" <Pierre.Humblet@eurecom.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@sourceware.cygnus.com