double strtod(char*,char**)
i need a replacement, is there a free one? my program cannot use stdlib.h, and the target enviroment is very picky about "standard" functions.
could atof be used to replace this?
double strtod(char*,char**)
i need a replacement, is there a free one? my program cannot use stdlib.h, and the target enviroment is very picky about "standard" functions.
could atof be used to replace this?
What program do you use? If you can't use the stdlib.h file, then you will not be able to use atof() either. Can you use the string.h file? As I remember, the strtod() function is defined in that header.
David
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them
In the Land of Mordor where the Shadows lie.
i'm writing a graphing calculator for a pda(vtech helio) which uses weird libs. i have the parser for the equation from snippets.org, but it needs strtod. my compiler is gcc, although i don't know what version. the compiler, linker, etc.. are all dos programs. I know i definitely cannot use stdlib.h, but i'm not sure about string.h. i doubt it, though.
why cant you use stdio.h ?
Monday - what a way to spend a seventh of your life
Well a really simple - no error checking - atoi would look like this
Code:char buff[] = "1234"; // for example int result = 0; int i; for ( i = 0 ; buff[i] != '\0' ; i++ ) { result = result * 10 + buff[i] - '0'; }
the sdk for this pda doesn't include most normal functions. check out the message board at pdabuzz.com -> other platforms -> vtech -> vtech software development for more info. it also sucks at float calculations, although double works.
would i be correct if i said that:
1)strtod(char* sz1,char** psz2) takes the beginning characters of the string sz1 and stopped when it wasn't a number anymore, where that pointer would be passed back through psz2?
2) would i be correct in assuming that the psz2 is not needed most of the time? from eval.c:
endptr appears only twice in eval.c: when it's defined and here. i'm thinking if it's not needed, something like atof could be used instead.Code:if (0.0 == (arg = strtod(str, &endptr)) && .....