From: Cactus on
How to convert unsigned char* to CString:

I have some data and wrote some function to convertion data to CString
and dispay it:
e.g.
u_char_[0] =10;
u_char_[1] =100;
u_char_[2] ='A';
u_char_[3] ='\0';

Convert_to_CS(u_char_);

****
void Convert_to_CS (unsigned char* u_char){

CString str0;

str0.Format("%d",u_char[0]);
AfxMessageBox ("First:" +str0);

CString str(u_char);
AfxMessageBox ("Second:" +str);

}

***

Output:
First: 10 //good
Second: // so nothing, why ??

Why working only first convetion ? I want convert whole array of uchar,
how to do it ?
When I declare on input:
unsigned char u_char[] ="abcdef" then works good and display :
Second: abcdef
but I must put data individually for each byte...

From: David Wilkinson on
Cactus wrote:

> How to convert unsigned char* to CString:
>
> I have some data and wrote some function to convertion data to CString
> and dispay it:
> e.g.
> u_char_[0] =10;
> u_char_[1] =100;
> u_char_[2] ='A';
> u_char_[3] ='\0';
>
> Convert_to_CS(u_char_);
>
> ****
> void Convert_to_CS (unsigned char* u_char){
>
> CString str0;
>
> str0.Format("%d",u_char[0]);
> AfxMessageBox ("First:" +str0);
>
> CString str(u_char);
> AfxMessageBox ("Second:" +str);
>
> }
>
> ***
>
> Output:
> First: 10 //good
> Second: // so nothing, why ??
>
> Why working only first convetion ? I want convert whole array of uchar,
> how to do it ?
> When I declare on input:
> unsigned char u_char[] ="abcdef" then works good and display :
> Second: abcdef
> but I must put data individually for each byte...
>

You already have an active thread on this topic in
microsoft.public.vc.mfc. Why are you startinga nother one here?

David Wilkinson