unsigned char to char * is fairly simple
-
unsigned char uc = 'A';
-
-
char *p = (char *)&uc;
-
-
/* and back */
-
-
uc = *p; /* this may produce a warning that can be removed with a cast */
-
The cast is needed because you are loosing the unsigned qualifier. Of course this does not give you a pointer to a c string because a c string requires zero termination there for a single character requires an array of at least 2 characters so that the zero terminator can be included.
unsigned char to CString is a little more problematic, I can't remember if you can just assign a char to a CString, if so no problem. If not the easiest way is probably to clear the CString and add (+) the unsigned char probably casting it first.
-
unsigned char uc ='A';
-
-
CString str;
-
-
str = (char)uc; /* Not sure if this works */
-
-
str = ""; /* fairly sure this will work */
-
str += (char)uc;
-
-
/* and back */
-
-
uc = str[0]; /* Extract the first character of str */
-