请问wchar 转float 如何转换

解决方案 »

  1.   

    把宽字符转化为窄字符,然后用atof
      

  2.   

    我的代码是这样的:
        wchar* str=L"111.0";
        float i;
        i=(flaot)atof((char*)(LPCTSTR)str);
        CString str1;
        str1.Format(L"%f",i);
        AfxMessageBox(str1);
    可是得到的结果为 1.00000
    这是怎么回事咯?请指教!
    有没有象_wtoi()一样的函数转换成float
      

  3.   

    WCHAR* str=L"111.0";
    CString str1 = str;
    float i;i=atof(str1);
    str1.Format("%f",i);
    AfxMessageBox(str1);