I got character 163 from Windows internal character map (you can find it from the Seacrh menu by searching for 'Character map').
It looks like you'll need to post your project if you want any further help with this.
Printable View
I got character 163 from Windows internal character map (you can find it from the Seacrh menu by searching for 'Character map').
It looks like you'll need to post your project if you want any further help with this.
thanks, it is quite a small project though.
Well, this is quite interesting. I changed your code to be this:-
and I put a break point at the return(0); line. The first cout prints the expected text in my DOS window. The second version prints the expected text to string 's' when I examine the string in my debugger. When the cin line was reached, 'c' was equal to -93 (character 163). I then typed the £ sign on my keyboard. This displayed the correct symbol in my console window and gave me a result of -100 for 'c'.Code:#include <iostream.h>
#include <stdio.h>
int main()
{
char c;
char s[25];
c = -100;
sprintf(s, "Pound sign = %c\n", c);
cout << s;
c = '£';
sprintf(s, "Pound sign = %c\n", c);
cout << s;
cin >> c; // Just wait for a bit
return 0;
} // end main
Obviously, Windows and DOS use different values for the '£' symbol. DOS uses character 156 and Windows uses character 163.
Thank you for your time and info, which is a surprise to me, as i thought that "win32 console app" is a windows app, not dos, but it shows that it is true only partially ?
as i sayd there is some api to fix this i just dont know what it is
:(
i could not find this api though. what i found , someone said that in order to use '£' you should use unicode. this seems too much of a hassle to me, as i do programming only in english.
If you check the Character Map utility you will find that the Terminal font uses a different mapping to the rest of the Windows fonts with the Ú at 165 and the £ at 156. This is probably the font that Windows uses as default for console apps and was the mapping for DOS.
If you set the font for the console window to Lucinda Console then I suspect all would be ok. :thumb:
You can also get very strange effects when importing a text file with accented characters, that was created with an old DOS editor. :eek:
yes, it looks like terminal uses "terminal" and "lucida console" font, however the character set is probably "dos: western europe", so setting it to "lucida console" makes no difference, as unicode and dos mappings differ for this font.
You're right, I just checked with a console app, running once with the default font, changing the font to Lucinda Console and then running again. I got the ú both times. Interestingly, if I copy the text from the console and paste elsewhere it stays as a ú. (ie. It doesn't change to a £)