Archived

This topic is now archived and is closed to further replies.

matt_j

easy fscanf question

Recommended Posts

I would like to know why this doesn''t work: fscanf(file,"%lf %lf %lf", &vertex[z].x, &vertex[z].z,&vertex[z].y); for the following data in a file: 0.5 0.49999997019767761 0.0

Share this post


Link to post
Share on other sites
You would have to write all your values with the same precision, otherwise it won''t read them at all. I don''t know why it is so, but when I write %f %f %f it assumes 6 precision value for each %f.

Just try to make them of the same length, e.g:
0.5 = 0.50000000000000000
0.49999997019767761
0.0 = 0.00000000000000000

Although that would be a huge waste of memory, I''d recommend that you choose a precision of the values.

Good luck.

" Do we need us? "


Ionware Productions - Games and Game Tools Development

Share this post


Link to post
Share on other sites