D
DeMarcus
Hi!
How do I convert a char or wchar_t to an int in a proper and portable way?
If I do this
char wickedChar = 'Æ';
unsigned int myInt = c;
then myInt is a very big number, it's the sign bit of wickedChar that
does that.
Maybe I could do something like
unsigned int myInt = (unsigned char)c;
but the problem is that this is a template so I don't know if it's going
to be a char or wchar_t (or even something else).
How can I convert the char (or wchar_t) to an unsigned int in a portable
way?
Thanks,
Daniel
How do I convert a char or wchar_t to an int in a proper and portable way?
If I do this
char wickedChar = 'Æ';
unsigned int myInt = c;
then myInt is a very big number, it's the sign bit of wickedChar that
does that.
Maybe I could do something like
unsigned int myInt = (unsigned char)c;
but the problem is that this is a template so I don't know if it's going
to be a char or wchar_t (or even something else).
How can I convert the char (or wchar_t) to an unsigned int in a portable
way?
Thanks,
Daniel