MFC中控件上的文本大多为CString,有时为了方便操作需要转为string
CString caption;
GetDlgItemText(IDC_EDIT, caption);
CStringA temp(caption.GetBuffer(0));
string str = temp.GetBuffer(0);
temp.ReleaseBuffer();
caption.ReleaseBuffer();
转成string就方便多了
MFC中控件上的文本大多为CString,有时为了方便操作需要转为string
CString caption;
GetDlgItemText(IDC_EDIT, caption);
CStringA temp(caption.GetBuffer(0));
string str = temp.GetBuffer(0);
temp.ReleaseBuffer();
caption.ReleaseBuffer();
转成string就方便多了