atof,该如何处理

atof
m_studyyear=(float)atof(dlg.m_strYear);
m_studyyear是float型,dlg.m_strYear设置成CString型。虽然返回值是double,怎么强制转换还是报错
“atof”: 不能将参数 1 从“CString”转换为“const char *”

我用的是VS2010

------解决方案--------------------
char *buf;
dlg.m_strYear.GetBuffer(buf);
m_studyyear=(float)atof(buf);
dlg.m_strYear.ReleaseBuff();

函数名可能有点不对,这么试试,如果编绎有问题,就改成char buff[19];

------解决方案--------------------
_tcstod();
------解决方案--------------------
UNICODE字符集

用_ttof 或者 _tcstod