views:

148

answers:

3

I am currently writing a C application and I need to display the following symbols 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?

+7  A: 

These are not in ASCII nor in LATIN1 for instance.

lhf
They aren't even in CP1252, the normal Windows code page, AFAICS. They look like U+2264 and U+2265 in Unicode.
Jonathan Leffler
+4  A: 
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.

Jed Smith
still nothing with `printf("\xf2\n");` ...an equals sign (=) is displayed
Andreas Grech
This means you're using code page 850 (http://en.wikipedia.org/wiki/Code_page_850) which does not encode the ≥ or ≤ glyphs.
Michael Petrotta
Try changing to code page 437 with chcp (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/chcp.mspx?mfr=true)
Michael Petrotta
+1  A: 

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.

Artelius