The simple answer is no. The mode is determined when the iostream object is constructed, and cannot be changed later. Some implementations may provide a means of doing it later, but this isn't standardized. On some implementations, doing an freopen
on stdout
might change the mode, although I think that formally, this is forbidden in C++. (It is implementation defined in C.) And apparently, it doesn't work on your implementation.
You're best bet is to find out how your system names the console device ("/dev/tty"
under Unix; "CONS"
, I think, under Windows), open it in the desired mode, and output to it.