Pregunta

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

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top