char* TempPackBytes = new char[TempPackLen];
memset(TempPackBytes, 0, sizeof(char)*TempPackLen );
for (int i = 0; i < TempPackLen; i++)
{
char a=Totalbytes[i + DataHeadLen];
TempPackBytes[i] = Totalbytes[i + DataHeadLen];
}
CString str=(char*)TempPackBytes; // 获得内容 把内容(TempPackBytes)转化为串等之类的东东 TempPackBytes
1. char* 转成CString
(1)可以直接构造函数.如下:
char * p = "test";
CString str(p);
(2)可以用成员函数Format 如下:
char* p = "test;
CString str;
str.Format("%s", p);
2. CString 转 char*
char* ch = cstring.GetBuffer(cstring.GetLength());