c - fscanf input with floats -
i'm reading text file contains:
mary 55334422 24.90 56.6 45.68
and reading in:
....char name[20]; int num; double worked; double rate; double total;.... fscanf(fp, "%s %d %f %f %f\n", name, &num, &worked, &rate, &total);
i'm getting name , integer fine, floating point numbers come out -9522999990000000000000000000.00
am doing wrong here?
you need use format double: %lf
, rather float %f
... or change floats instead of doubles.
Comments
Post a Comment