I'm still learning C++, so bear with me and my sloppy code. The compiler I use is Dev C++. I want to be able to output Unicode characters to the Console using cout. Whenver i try things like:
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
std::cout << "Blah blah blah some gibberish unicode: ĐĄßĞĝ\n";
system("PAUSE");
return 0;
}
It outputs strange characters to the console, like µA■Gg. Why does it do that, and how can I get to to display ĐĄßĞĝ? Or is this not possible with Windows?
system("pause");
but the article you link to is just as bad. For one thing, justcin.get()
does not usually suffice. Pausing does a whole lot more, most prominently cleaning the input buffer. Doing that in a portable, reliable way in C++ is extremely hard. In fact, the two solutions I know (ignore 1–cin.rdbuf()->in_avail()
, 2–numeric_limits<streamsize>::max()
) fail on different current compilers (they compile but don’t work). The rest of the linked page is a straw-man argument. Who cares that pausing is costly? It’s only called once! – Perspicacity