How do I convert a CString data to a double?<br>
I need to perform calculations on string input.<br>
//This doesn't work - how to do it?<br>
CString string;<br>
double thedouble;<br>
thedouble = (double) string;<br>
<br>
DigitalOx<br>
You can cast a CString to LPCSTR, then use atof to convert it to a double. Just change your third line to:<br>
<br>
thedouble = atof((LPCSTR)string);<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.