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: cygwin@sourceware.cygnus.com
- Subject: Re: setmode (long)
- From: "E. Robert Tisdale" <edwin@netwood.net>
- Date: Thu, 25 Feb 1999 22:26:57 -0800
- Delivered-To: listarch-cygwin@sourceware.cygnus.com
- Delivered-To: mailing list cygwin@sourceware.cygnus.com
- Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
- References: <199902260257.UAA08616@modi.xraylith.wisc.edu>
- Sender: cygwin-owner@sourceware.cygnus.com
- Sender: edwin
Mumit Khan wrote:
> 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?
No, I can't just now.
I sent the computer with Windows 98
and the DJPP and Cygnus compilers to my brother-in-law.
You'll have to wait until I can fire up my old Windows 95.
> 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.
Can you tell me where I can get documentation
for this behavior in setmode?
I got the file descriptors for standard I/O from
0 == (cin.rdbuf())->_fileno
1 == (cout.rdbuf())->_fileno
2 == (cerr.rdbuf())->_fileno
because a
ostdiostream has a
stdiobuf which is a
filebuf which is a
streambuf which is a
_IO_FILE which has an
int _fileno.
Is there a portable way to get file descriptors
for cin, cout, cerr and clog?
I suspect that Pierre may indeed have part of the answer
for his Windows 95 OS and his Emacs shell
but it doesn't explain why my `test.out' files
appear to be written in binary mode
even when the last mode set is text mode.
E. Robert Tisdale <edwin@netwood.net>
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com