[C++] CString to const char*
CString strTest = _T("Test");
const char *pTest = (CStringA)strTest;
CStirng strTest2 = (CString)pTest;
//////////////////////////////////////////////////////////////////////////////////
유니코드의 경우 아래의 방법을 참조.
CString -> char*
CString str = _T("권오철");
char *buffer = new char[str.GetLength()];
strcpy(buffer,CT2A(str));
buffer;
delete buffer;
String -> char*
char ch[100];
strcpy(ch,(LPSTR)(LPCTSTR)"나는 누구인가?");
CString -> BYTE
BYTE msgProxy.byData;
CString strText = _T("ㅇㅇㅇ");
memcpy(msgProxy.byData,T2CA(strText), nLen);
BYTE byBuffer[100];
CString strText = _T("DDD");
strcpy((LPSTR)byBuffer,T2CA(strText));
m_SocketManager.WriteComm( byBuffer, nLen, INFINITE);
char * -> CString
CString str = (LPCTSTR)(LPSTR)char * // 이방법은 좋지 않다 .. 글씨가 깨진다
char getMessage[100] = "나는 천재인가";
CString strMessage;
strMessage.Format(_T("%s"),CA2T(getMessage));