This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

strtod() buggy ?

Hi all,
I encountered a problem when using the stdlib-function
double strtod (const char *string, char *endp);

---
char *End;
float fValue = (float)strtod(String, &End);
---

The conversion works fine but weird values are assigned to the char-Pointer "End" which should point to the first character that could not be converted.
Using strtol or strtoul does not show this problem.

Btw. the String used for testing of course is terminated.

Anyone recognized this problem before ? I'm using uV ver3.00 with C166 ver5.00

Best Regards

Parents
  • mmh, I copied the prototype from the keil manual. Obviously there's another mistake. This is the prototype from stdlib.h

    double strtod (const signed char *str, signed char **ptr);

    And there's no other way to let a function return more than one value anyway. I don't think thats the problem.

Reply
  • mmh, I copied the prototype from the keil manual. Obviously there's another mistake. This is the prototype from stdlib.h

    double strtod (const signed char *str, signed char **ptr);

    And there's no other way to let a function return more than one value anyway. I don't think thats the problem.

Children
No data