++代码
- //将CString转换成const char*
- USES_CONVERSION;
- CString str = _T("要转换的字符");
- const char* lpcs = NULL;
- lpcs = T2A(str.GetBuffer(str.GetLength()));
C++代码
- //将CString转换成LPCSTR
- USES_CONVERSION;
- CString str = _T("要转换的字符");
- LPCSTR lpcs = NULL;
- lpcs = T2A(str.GetBuffer(str.GetLength()));
- //LPCSTR其实就是const char*