void Ccstr_strDlg::OnBnClickedStr()
{
// TODO: 在此添加控件通知处理程序代码
//CString 到string 的转换
CString str2 = _T("一九九二年那是一个春天,有一位老人在中国的南海边划了一个圈!");
int iSize;
/*
setlocale(LC_ALL, "chs");
char *p = new char[str2.GetLength()*2+1];
wcstombs(p,str2,str2.GetLength()*2+1);
string m_fileName = p;
*/
/*
char *temp=new char[str2.GetLength()*2+1];
WideCharToMultiByte(CP_ACP,0,str2.GetBuffer(),-1,temp,str2.GetLength()*2+1,NULL,NULL);
string m_fileName=temp;
*/
iSize = WideCharToMultiByte(CP_ACP, 0, str2.GetBuffer(), -1, NULL, 0, NULL, NULL);
str2.ReleaseBuffer();
char * temp=new char[iSize+1];
WideCharToMultiByte(CP_ACP, 0, str2.GetBuffer(), -1, temp, iSize, NULL, NULL);
str2.ReleaseBuffer();
string m_fileName=temp;
//string 到CString的转换
CString cstr2(m_fileName.c_str());
}