Mixing cout and wcout in same program

When cout or wcout is called for the first time, the orientation for stdout becomes set. In the case of cout, stdout becomes a byte-oriented stream, and in the case of wcout, stdout becomes a wide-oriented stream. Per the C++ standard [27.4.1] and C standard [7.19.2], once the orientation of a stream is set, you should not call a function which is not compatible with the orientation of that stream.

Leave a Comment