CString is a very useful MFC class for string management. But, sometimes we want to convert CString data to TCHAR or something.

here is one small code snippet for performing this operation. 😉

CString csData(_T(“”));
LPTSTR szData = csData.GetBuffer();
or like this
CString csTemp( "Sample data" );

LPTSTR lpszData = new TCHAR[csTemp.GetLength()+1];

_tcscpy(lpszData , csTemp);

delete[] lpszData;// don't forget to do this.