Jump to content
  • Advertisement


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


easy fscanf question

This topic is 5649 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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.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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!