CString P_Cstring= _T("我的字符串");//需要被转化的Cstring
int nLength = P_Cstring.GetLength();
int nBytes = WideCharToMultiByte(CP_ACP,0,P_Cstring,nLength,NULL,0,NULL,NULL);
char* P_char= new char[ nBytes];
memset(P_char,0,nBytes + 1);
WideCharToMultiByte(CP_OEMCP, 0, P_Cstring, nLength, P_char, nBytes, NULL, NULL);
int nLength = P_Cstring.GetLength();
int nBytes = WideCharToMultiByte(CP_ACP,0,P_Cstring,nLength,NULL,0,NULL,NULL);
char* P_char= new char[ nBytes];
memset(P_char,0,nBytes + 1);
WideCharToMultiByte(CP_OEMCP, 0, P_Cstring, nLength, P_char, nBytes, NULL, NULL);