conversion of ascii to char in vc++
-
11:46 am IST Monday Aug 29, 2005 Good Morning, How can I convert ascii code to char in vc++ for ascii codes between 128 - 255.
-
11:46 am IST Monday Aug 29, 2005 Good Morning, How can I convert ascii code to char in vc++ for ascii codes between 128 - 255.
converting int to char is implicit, it happens by itself. Christian Graus - Microsoft MVP - C++
-
11:46 am IST Monday Aug 29, 2005 Good Morning, How can I convert ascii code to char in vc++ for ascii codes between 128 - 255.
-
11:46 am IST Monday Aug 29, 2005 Good Morning, How can I convert ascii code to char in vc++ for ascii codes between 128 - 255.
-
11:46 am IST Monday Aug 29, 2005 Good Morning, How can I convert ascii code to char in vc++ for ascii codes between 128 - 255.
Since you mention codes 128 - 255, it is probably better to use unsigned char, since char will be negative in that range. As other replies have said, char and ASCII codes are the same thing. You can see either a character or a numeric value when using printf (or whatever other output). To see the difference, try the following:
char cMyChar; unsigned char ucMyUnsignChar; uMyChar = 77; // ASCII for "M" ucMyUnsignChar = 77; printf ("Character is %c, value is %i, unsigned is %c, unsign value is %i.\n",uMyChar,uMyChar,ucMyUnsignChar,ucMyUnsignChar); ucMyChar = 220; // Some "upper ASCII" character ucMyUnsignChar = 220; printf ("Character is %c, value is %i, unsigned is %c, unsign value is %i.\n",uMyChar,uMyChar,ucMyUnsignChar,ucMyUnsignChar);
NOTE: I'm not sure if this is correct - I don't have access to a C compiler on my office PC. I'm sure others will help! -
11:46 am IST Monday Aug 29, 2005 Good Morning, How can I convert ascii code to char in vc++ for ascii codes between 128 - 255.
5:20 am EST USA What the other respondents are saying is correct, there realy is no conversion required. I suspect that your probably having a character set (font) problem. INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen