第一种:
CString str=_T("爱普生(中国)有限公司!");
TCHAR*ch=new TCHAR[str.GetLength()];
BYTE*pByte=nullptr;
for(int i=0;i<str.GetLength();i++)
{
ch[i]=str.GetAt(i);
}
pByte=(BYTE*)ch;
第二种:
CString str=_T("爱普生(中国)有限公司!");
TCHAR*ch=new TCHAR[str.GetLength()];
BYTE*pByte=nullptr;
memcpy(ch,str,str.GetLength());
pByte=(BYTE*)ch;
BYTE 字节数组转 CString
TCHAR*ch=(TCHAR*)pByte;
CString strT=ch;