We are used to convert string to int/double by CRT provided functions, 数值和字符串相互转换(C++ 数据类型转换技巧)
Actually STL provides more graceful way to do this kind of conversion by istringstream / wistringstream:
#include<sstream>
using namespace std;
double dVal = 0;
wistringstream wstrStream(str);
wstrStream >> dVal;
wistringstream wstrStream(str);
wstrStream >> dVal;