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)



"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