I have tried to convert a CString
To BYTE*` and "BYTE* to CByteArray" in MFC, With Your Suggestions The CString Has Been Converted To BYTE*. But I'm not able to Convert The Entire Byte* To CByteArray It Returns Partial Data With Some Garbage Values.
I Described My Actual Problem Here...
The code:
CString csData =_T("someData");
BYTE *pByteArray = (PBYTE)(LPCTSTR)csData.GetBuffer();
CString str;
str=LPTSTR(pByteArray);
AfxMessageBox(str); //returns "someData"
CByteArray arrByte2;
arrByte2.SetSize(csData.GetLength()+1);
memcpy(arrByte2.GetData(), pByteArray, csData.GetLength()+1);
CString text((LPTSTR)arrByte2.GetData(),arrByte2.GetSize());
CStringA result(text);
AfxMessageBox(text);//returns "some﵄﷽ꮫꮫ"