Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CString conversion

Status
Not open for further replies.

DigitalOx

Programmer
Sep 29, 1998
41
0
0
US
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>

 
There is a cast of LPCSTR for a CString, and a function "atof" to convert ASCII to double, so I would just change your third line above to:<br>
<br>
thedouble = atof((LPCSTR)string);<br>
<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top