笔记,将CString转换为数值

         ANSI  UNICODE  TCHAR

int     atoi     _wtoi     _ttoi

long       atol     _wtol     _ttol

double   atof     _wtof    _ttof

示例

#include <iostream>
#include <atlstr.h>
int main()
{
    using namespace std;
    CString oneHundred("100");
    int i = _ttoi(oneHundred);
    cout << "i: " << i << endl;
    CString oneThousand("1000");
    long l = _ttol(oneThousand);
    cout << "l: " << l << endl;
    CString doubleString("3.14159");
    double d = _ttof(doubleString);
    cout << "d: " << d << endl;
    system("pause");
    return 0;
}

参考链接:怎样将CString类型转换成数值_百度知道

猜你喜欢

转载自www.cnblogs.com/buyishi/p/10410164.html
今日推荐