I am just trying to print a shape filled with filled ASCII boxes into the console, but the output is just garbage text. Here is my code:
#include <stdio.h>
const char shade_block[] = {
"▒▒██████▒▒\n\
▒████████▒\n\
██████████\n\
▒████████▒\n\
▒▒██████▒▒\n\
"};
int main()
{
printf(shade_block);
return 0;
}
And here is the output:
ΓûÆΓûÆΓûêΓûêΓûêΓûêΓûêΓûêΓûÆΓûÆ
ΓûÆΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûÆ
ΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûê
ΓûÆΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûÆ
ΓûÆΓûÆΓûêΓûêΓûêΓûêΓûêΓûêΓûÆΓûÆ
Picture of the code, if it's not displaying properly.
I am working in C, CodeLite IDE, WIndows 10 with MinGW-32. Thanks in advance.
Though RbMm and PeterJ's answers worked, I used tips from this StackOVerflow question and eventually figured out how to print the block as-is without any character-escaping or WriteConsoleW:
#include <stdio.h>
#include <wchar.h> //For wprintf and wide chars
#include <io.h> //For _setmode
#define U_16 0x20000 //U-16 text mode, for the text blocks
const wchar_t shade_block[] = {
L"▒▒██████▒▒\n"
"▒████████▒\n"
"██████████\n"
"▒████████▒\n"
"▒▒██████▒▒\n"
};
int main()
{
_setmode(_fileno(stdout), U_16); //set the output mode to U_16
wprintf(L"%s\n", shade_block);
return 0;
}