![]() |
| ||
| convert char* to double hey, how would i go about converting a char* character array to a double. I would like to create a function that takes a char array as a parameter such as "1234.1" and then return that as a double value 1234.1. Is there a function that would allow me to do this or would i have to go about programming it myself? Thanks. |
| ||
| Re: convert char* to double >hey, how would i go about converting a char* character array to a double. Provided the array is actually a string with a terminating '\0' character at the end, you can use strtod. Or, since this is C++, stringstreams make the conversion intuitive if you're used to cin and cout: #include <sstream> |
| All times are GMT -4. The time now is 5:07 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC