I want to print ■(in ascii code 254) in c visual studio project with function printf, but my program can't print. Just like(? instead of ■)
My program can print ascii character 32 ~ 128.
I think since 129~254 is extended ascii, it requires more code(header?other function?).
How can i print ■? help me please.
here is my code.
#include<stdio.h>
int main() {
unsigned char count;
for (count = 32; count < 255; count++) {
printf(" %3d - %c", count, count);
if (count % 6 == 0) {
printf("\n");
}
}
return 0;
}
I just have solved by adding system("chcp 437"), which changes language Korean to English in cmd(dos window).
here is my code
#include<stdio.h>
#include<Windows.h>
int main() {
unsigned char count;
system("chcp 437");
for (count = 32; count < 255; count++) {
printf(" %3d - %c", count, count);
if (count % 6 == 0) {
printf("\n");
}
}
return 0;
}