AnsweredAssumed Answered

Can not use the function „strtod“

Question asked by nico engel on Jun 1, 2012
Latest reply on Jun 8, 2012 by nico engel

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.

 

Outcomes