一个长度比较长的字符串数据转换为double型数据,
自己写的,比较简单,如下:
(Windows XP, VC6调试通过)
#include "math.h"
CString str = "81627781917573120.0000";
int i=0, j=0;
double bb=0;
for(i=str.GetLength(), j=0; i>0; i--, j++)
{
bb = bb + atoi(str.Mid(i-1, 1)) * pow(10, j);
}
CString sTemp;
sTemp.Format("%f", bb);
AfxMessageBox(sTemp);
仅供参考,欢迎大家提意见!