Hello,
I have to translate numbers from string to double. Therefor I would like to use the function “strtod(char *x, char **y)”
I test this with following code:
double result = 0;
char *sub_str_end = NULL;
char test[] = "1.234";
//! Test 1
result = strtod(test, NULL);
//! Test 1
sub_str_end = test+4;
result = strtod(test, &sub_str_end);
if (errno != 0)
printf("ERRNO\n");
But if I use this code, I get the number “-927712936.000000” for result.
Does anyone has an idea why this not work? (Are there missing compiler settings?)
Thanks.
Hello soli,
your program uses compilers strtod, you haven't specified which one, if it was for CW,IAR or KEIL.
Anyway, MQX provides its function called _io_strtod which is located in a file io_fp.c in the directory source/fio.
Try _io_strtod and share with us if it works for your case.
Regards,
MartinK