Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi all,
i've a code as follows.
CString string;
string.Format("%e",1.23456-e246);

Is this the correct way of formatting?

My next doubt is how can i convert this formatted CString to double.

double d = static_cast<double>(ttof(string));

Is this the correct way?

thank you in advance
Posted
Comments
Sergey Alexandrovich Kryukov 24-Jan-13 0:02am    
VB6?! "Convert"? static_cast?! (Sigh...)

How can I unsee this? :-)

—SA

1 solution

string.Format("%e",1.23456-e246);

isnt right, you need a variable with that value.

you read that http://msdn.microsoft.com/en-us/library/hf4y5e3w(v=vs.71).aspx[^]

use the _atof function:

http://msdn.microsoft.com/en-us/library/hc25t012.aspx[^]

I suggest to read some basic stuff and tutorials
 
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