Apologies up front for not finding this already. I'd Googled earlier and didn't find what I was looking for in a reasonable amount of time. And then I've had many distractions throughout this time too.
The basic thing is this: with Code::Blocks' setup with MinGW, I tried to do this:
It ain't takin' too kindly to some C99-okay input, and I've been trying to see if that's a bug with MinGW's standard library implementation, or if I need to further link with specific libraries.
int mygetd(double *result);
double value = -12.3;
fputs("Enter a floating-point number: ", stdout);
} while ( !mygetd(&value) );
printf("value = %g\n", value);
* Attempt to read a double value from the stdin.
* @param result pointer to a double into which the result will be written if
* a double is successfully converted
* 0 - failed to convert all text into a valid double, or
* 1 - successfully obtained a double and placed its value in *result
int mygetd(double *result)
char *end, buff [ 32 ];
fgets(buff, sizeof buff, stdin);
errno = 0;
*result = strtod(buff, &end);
if ( errno )
return !isspace(*buff) && (*end == '\n' || *end == '\0');
/* my output
Enter a floating-point number: 0X1P-23F
Enter a floating-point number: 0X1.fffffffffffffP1023
Enter a floating-point number: 1.7976931348623157E+308
value = 1.79769e+308
I'll continue looking, but if anyone else cares to take the time to lend me a hand, I'll be grateful.