MacBook Air 13. OSX ElCapitan system. I compile the code through the terminal

#include <stdio.h> #include <locale.h> int main(void) { unsigned char c; for (c = 32; c <= 255; c++) { printf("%c",c); } return 0; } 

At the exit I get

 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????`. 

that is, characters up to 127 codes from the table are displayed. And then everything is replaced with questions. How to use extended ASCII table in the range of 128-255. The table was used by reference http://www.ascii-code.com/ . Thanks in advance for your reply.

  • You have no idea what difficulties you are trying to plunge into, but in short, you need to forget about the fact that the symbol = 1 byte, and forward to Unicode! - 0andriy

1 answer 1

Try switching to the standard locale. In the body of the main() function, add setlocale (LC_ALL,""); or setlocale (LC_ALL,"C");

  • Unfortunately it did not help. Nothing has changed. I tried the same code on a computer under Windows, there are no such problems. - Mohammed Abdullaev