unsigned char* to const char*
-
Hello dear friends, How to convert unsigned char* to const char*. Thanks in advance to all of you.
ritz1234
Why do you need this conversion? What are you trying to achieve? I am asking this because the '
const
'ness would matter much, only if you are trying to cast the const away. Are you trying to pass an unsigned char* to a function that expects a const char*? There's no harm in that case, because you are merely providing a modifiable value to a function which promisingly will not modify the value given to it. You also need to know the possible loss of data that might occur while converting between signed and unsigned datatypes.Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Hello dear friends, How to convert unsigned char* to const char*. Thanks in advance to all of you.
ritz1234
Try this
unsigned char *chr = Some_value; const char *ch = (const char *)chr;
You sholud also use Google sometimes...:)Mukesh Kumar Software Engineer