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!

Simple casting question

Status
Not open for further replies.

gmgarrison

Programmer
Sep 26, 2000
11
0
0
US
I've got a numerical value stored in a CString that I'd like to have in a double. What's the most accurate way of casting? Thanks in advance...

greg
 
Depending on your context and needs either one of the following might provide a solution, however there are others like scanf().

Hope this helps
-pete

strtod, wcstod
Convert strings to a double-precision value.

double strtod( const char *nptr, char **endptr );

double wcstod( const wchar_t *nptr, wchar_t **endptr );

Each of these functions converts the input string nptr to a double.


atof, atoi, _atoi64, atol
Convert strings to double (atof), integer (atoi, _atoi64), or long (atol).

double atof( const char *string );

int atoi( const char *string );

__int64 _atoi64( const char *string );

long atol( const char *string );

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top