Reputation: 2210
I am trying to print some "special" characters (above 127) in the console, but somehow it doesn't get printed.
I have this small code snippet:
#include <iostream>
int main()
{
std::wcout << L"a■■■■■■■■■■■a■■■■■■■■■■■■■■a" << std::flush;
return 0;
}
it prints the 'a' but then... nothing. and it doesn't matter if I use cout/string or wcout/wstring. (with cout I only see "?" and in wcout nothing, it ends the stream)
The ascii code is 254 for this character. What can be happening here? I thought this is okay to print?
Upvotes: 3
Views: 1390
Reputation: 96790
From the answer I linked to in the comments, I think this is your solution:
#include <fcntl.h>
#include <io.h>
_setmode(_fileno(stdout), _O_U8TEXT);
Upvotes: 3