What about std::wcout ?
#include <iostream>
int main() {
std::wcout << L"Hello World!" << std::endl;
return 0;
}
This is the standard wide-characters output stream.
Still, as Adrian pointed out, this doesn’t address the fact cmd, by default, doesn’t handle Unicode outputs. This can be addressed by manually configuring the console, like described in Adrian’s answer:
- Starting
cmdwith the/uargument; - Calling
chcp 65001to change the output format; - And setting a unicode font in the console (like Lucida Console Unicode).
You can also try to use _setmode(_fileno(stdout), _O_U16TEXT);, which require fcntl.h and io.h (as described in this answer, and documented in this blog post).