2

first of all thanks for reading ^ ^

ok, so I'm making an easy menu for a console project after I created the options I wanted to add the char(240) as another option but I can't figure out how to declare it I cant just write ≡ because Dev++ won't let me write it, the code is:

char *menu_list[6] = { " SYMBOL GOES HERE "," View ", " Edit ", " Search ", " Reset", " Quit " };

does anyone know how to do this? or if I'm doin it all wrong, can you tell me the right way to do it?

i'm forced to make it work on windows, i can

cout << char(240);

and it works right, but I cannot store that same symbol into menu_list

also I got the code from here

http://www.theasciicode.com.ar/extended-ascii-code/hyphen-ascii-code-240.html

8
  • 1
    I'm not sure, you want to add ≡ as a menu item? Because I'm pretty sure that's not an ascii symbol. Here is a list of all the available symbols. Commented Apr 27, 2014 at 3:32
  • 1
    U+2261 (≡) requires 3 bytes to encode in UTF-8, it is most certainly not an ASCII character. Nothing above 127 is. Commented Apr 27, 2014 at 3:36
  • 1
    @AndonM.Coleman This site asciitable.com lists extended ascii codes which are different from the extended ascii codes listed here - ascii-code.com. Is this extension non-standard? Commented Apr 27, 2014 at 3:38
  • 2
    @ajay: Yes, there are multiple code pages for characters > 127. Those are the line drawing ones used by PC BIOS, DOS, etc. Code Page 437 Commented Apr 27, 2014 at 3:41
  • 2
    @ajay There could certainly be a codepage which contains said symbol (or you could even define one...), but especially for nonstandard codepage, we need to know which one is used Commented Apr 27, 2014 at 3:41

1 Answer 1

4

There was a deleted answer that had the correct response: use "\xf0" to represent the character.

Ordinarily you would need to know which code page is being used by Windows to know how a character code maps to a particular character on screen. However by doing the research yourself, you already know that the decimal value 240 represents the character you need. That decimal 240 is the same as hex f0, and the way to embed a hex literal value in a string is to prefix it with \x.

As noted in the link you posted, these codes correspond to code page 437. This is the one used by the command window in English versions of Windows; I'm not sure if alternate language versions of Windows use anything different. Calling this "extended ASCII" is confusing, since there have been many attempts to extend ASCII over the years and none of them are the same.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.