mostly-standard scanf

This commit is contained in:
pommicket 2022-02-15 15:40:15 -05:00
parent 1ea9d85e3f
commit f973ff8cb8
4 changed files with 433 additions and 47 deletions

View file

@ -3,11 +3,13 @@
#include <string.h>
int main(void) {
char *s = "1.35984534e135-e12hello";
char *end;
_Float f = _powers_of_10[-307];
printf("%.15g\n",strtod(s, &end));
printf("%s\n",end);
int count; float quant; char units[21], item[21];
while (!feof(stdin) && !ferror(stdin)) {
count = fscanf(stdin, "%f%20s of %20s",
&quant, units, item);
fscanf(stdin,"%*[^\n]");
printf("%d %g %s %s\n", count, quant, units, item);
}
return 0;
}