Mail Archives: cygwin/1999/01/03/17:40:46
Dobes Vandermeer <dobes AT mindless DOT com> writes:
>
> Here is my program:
>
> int main()
> {
> double val = strtod("3.123", 0);
> printf("TEST: %g %g\n", 3.123, val);
> return 0;
> }
Basic rule of C/C++ programming -- include the appropriate header so that
the prototypes are available. In your case, including stdlib.h should fix
it.
#include <stdlib.h>
#include <stdio.h>
int main()
{
double val = strtod("3.123", 0);
printf("TEST: %g %g\n", 3.123, val);
return 0;
}
> The results I WANTED would have 3.123 both times, and this is the
> behavior documented.
>
> This same behavior is exhibited by atof()... This is a bug, I think.
Yes, it's a bug in your code.
You should *really* pay more attention to the compiler when it complains
about not finding the prototypes for strtod, printf etc; that should've
given you a clue as to what is wrong.
Regards,
Mumit
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -