- CString与double,int互转
CString str = “33.33”;
double d1 = _wtof((LPCTSTR)str); //使用Unicode编码
double d2 = atof((LPCTSTR)str); //不使用Unicode编码
int i1 = _wtoi((LPCTSTR)str);
int i2 = atoi((LPCTSTR)str);
//=========================================================
double d1 = 33.3333333333333;
CString str1, str2;
str1.Format(_T(“%f”), d1); // str1 = “33.333333”
str2.Format(_T(“%.3f”), d1); // str2 = “33.333”