开发者

Displaying the ≥ and ≤ ASCII characters in a C Application

I am currently writing a C application and I need to display the following sy开发者_C百科mbols in the terminal : and

Their ASCII character codes are 242 and 243 but I can't get them to be displayed in the DOS terminal.

Any ideas on how I can do this?


These are not in ASCII nor in LATIN1 for instance.


printf("\xf2\n");

If that doesn't work, it's because of DOS and code pages. Try playing with the CHCP command. You're strolling into locales/platform-specific/give-up-now territory.


What DOS terminal? If you're compiling to a 32-bit (or 64-bit) binary under Windows, as I'm sure you are, then it's just a console window.

I believe this is the simplest way to set the code page of a console window. It's up to you whether to use code page 437 or a unicode code page (such as UTF-8, which is 65001), but I would suggest Unicode as it will give you more flexibility if you need it later.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜