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