Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

I declared the variable as CString and I'm trying to convert it as double using the following statement.
double Principal      = _wtof(m_Principal);


but it gives the error as _wtof undeclared identifier
How can I solve this error. If my statement is wrong then tell me how to convert a string to double in MFC Dialog based application

Thanks.
Posted
Updated 20-Jun-11 1:53am
v2
Comments
Slacker007 20-Jun-11 7:55am    
Edited for spelling, grammar, and readability.

use the function atof()
double Principal      = atof(m_Principal);
 
Share this answer
 
we have a function name atoi() in the library.

atoi() -> Ascii to integer

.......var = (double)(atoi(variable)).........

hope rest you knows... :)
 
Share this answer
 
The old C-conversion routines have their limitations.

It's better to use the C++ stream functionality to be able to catch errors.

Have a look at this post[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900