unsigned char
-
what's the use of unsigned char? if char is going to be characters?? -a , +a ?? and also tell me who to display it in an AfxMessageBox :( regards, Rookie Installing MFC...2% complete
You can use unsigned char (for example) to read single byte from file without re-interpreter it as integer (positive or negative values). But, In typical programs, the use is quite the same. To use the AfxMessageBox you can use it in the same way of the char. But your question is strange: the string is build with caratchars and they are translated in a defined numerical range: so if you want to display strange values (like 190) you will obtain only strange sign!!
Merry Christmas
Have a nice code day ;) -
what's the use of unsigned char? if char is going to be characters?? -a , +a ?? and also tell me who to display it in an AfxMessageBox :( regards, Rookie Installing MFC...2% complete
char
is quite bad named because its name confuses too much the newbies. of course, char goes to be used in strings, but first, that's not always true, and secondly, it does not serves only for that.char
in C/C++ is simply a signed byte, not more, not less. that means it can be used as a character (in strings), but also as an integer of 8 bits, or as a simple 8 bits array. about the signature, yes, achar
is by default signed, which means it contains values between [-128 ; +127]. but usually, the mainly used characters in the ascii tables are under the code 127 (over that, they are called extended char sets). if you want more than that, you'll have to use UNICODE instead of ASCII, which stores a character on 16 bits instead... to display a char string, simply use the""
notation, ,and the compiler will format your variable as needed ('\0' terminated)...
TOXCCT >>> GEII power
[toxcct][VisualCalc 2.20][VisualCalc 3.0] -
char
is quite bad named because its name confuses too much the newbies. of course, char goes to be used in strings, but first, that's not always true, and secondly, it does not serves only for that.char
in C/C++ is simply a signed byte, not more, not less. that means it can be used as a character (in strings), but also as an integer of 8 bits, or as a simple 8 bits array. about the signature, yes, achar
is by default signed, which means it contains values between [-128 ; +127]. but usually, the mainly used characters in the ascii tables are under the code 127 (over that, they are called extended char sets). if you want more than that, you'll have to use UNICODE instead of ASCII, which stores a character on 16 bits instead... to display a char string, simply use the""
notation, ,and the compiler will format your variable as needed ('\0' terminated)...
TOXCCT >>> GEII power
[toxcct][VisualCalc 2.20][VisualCalc 3.0]toxcct wrote:
char in C/C++ is simply a signed byte, not more, not less
It is simply a byte, but it can be signed or unsigned - it is left to compiler implementations to decide. For instance with VC++, char is signed by default unless the option /J is specified.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it. -- modified at 16:10 Saturday 24th December, 2005
-
toxcct wrote:
char in C/C++ is simply a signed byte, not more, not less
It is simply a byte, but it can be signed or unsigned - it is left to compiler implementations to decide. For instance with VC++, char is signed by default unless the option /J is specified.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it. -- modified at 16:10 Saturday 24th December, 2005
I'd suggesting creating a typdef as follows: typedef unsigned char to BYTE; BYTE's are pretty useful in walking through raw data streams, manipulating graphics by having to twiddle the bits of various pixels, etc. Read more of what I have to say at http://directx9.blogspot.com/