Unicode下可使用_wtof。不过最好使用_tstof,它实际上是宏,在不同的字符集下解释不同。这样两种字符集都可以编译通过。
CString str(_T("4.567"));
double data = _tstof(str);
CString strText;
strText.Format(_T("%lf"),data);
AfxMessageBox(strText);
CString str(_T("4.567"));
double data = _tstof(str);
CString strText;
strText.Format(_T("%lf"),data);
AfxMessageBox(strText);