str to double?
-
How can i put the contents of a string into a double? 100000000000000000000000000000000 for instance? :) atoi works up to the max value of a int, then it craps out... Thanks
try atof -c
Garbage collection, making life better - for weenies!
Image Processing - make images do the un-natural.
-
try atof -c
Garbage collection, making life better - for weenies!
Image Processing - make images do the un-natural.
If you need some formatting options try sscanf().
-
How can i put the contents of a string into a double? 100000000000000000000000000000000 for instance? :) atoi works up to the max value of a int, then it craps out... Thanks
I've always liked
strto_x_
, as it gives you some idea of whether or not the conversion worked:char* mightBeANumber;
char* pEnd;
double d = strtod(mightBeANumber, &pEnd);
if (!*pEnd) {
// probably worked!
}Just my opinion, anyway. Stuart Dootson 'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'