Mixing Wide & Narrow Character Output to stdout

A

Andy

Can I mix wide and narrow character output to stdout? I seem to remember
hearing this was not supported before but I can't find any reference to
such a restriction now I actually need to do it! It seems to work on my
Intel compiler but is it portable?

e.g.

#include <iostream>
#include <iomanip>

int main()
{
std::cout << "Narrow ";
std::wcout << L"Wide\n";
return 0;
}
 
D

Dietmar Kuehl

Andy said:
Can I mix wide and narrow character output to stdout?

I don't think there is a specific restriction in the C++ standard
but there is one in C standard, if I remember correctly. Effectively,
there is a state machine underlying the C stream (and the C++ streams
are generally defined in terms of these) which does not allow directly
mixing narrow and wide characters (see
<http://www.dinkumware.com/manuals/reader.aspx?b=c/&h=lib_file.html>).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top