我有一个edit control控件,edit1,我想把edit1里面的值读取出来,转换为double型变量,在VS2005建立的工程
CString str;
double dsum=0; edit1.GetWindowTextW(_T(str),10);//这里出错,不知怎么保存这个转换后的类型?我想保存成CString,不知有无更好办法
dsum=atof(_T(str));
CString str;
double dsum=0; edit1.GetWindowTextW(_T(str),10);//这里出错,不知怎么保存这个转换后的类型?我想保存成CString,不知有无更好办法
dsum=atof(_T(str));
edit1.GetWindowText(str);
dsum = a2f(W2A(str.GetBuffer()));
试一试!
_atof需要的是char*
从CString到char*转换用GetBuffer(str.GetLength());