Consider the following example:
#include <iostream>
int main() {
std::cout << "abc" << std::endl;
std::wcout << L"abc" << std::endl;
std::cout << "абв" << std::endl;
std::wcout << L"абв" << std::endl;
return 0;
}
On Linux its output goes like this:
abc
abc
абв
012
On Windows it's like this (note the absence of the last line):
abc
abc
рст
What (minimum) changes do I need to make to print "абв" right on both platforms?
ETA: Please note that this question is not about mixing different streams (removing either cout
or wcout
fixes nothing), nor is it about source file encoding (reading the strings instead of hardcoding them does not help either).