Jump to content
  • Advertisement

Archived

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

executor_2k2

Reading structs with fread

This topic is 5920 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

Im working on an animation parser for .3ds files, and I need to read in info from sturcts. Here''s the struct struct { short framenum; long unknown; float pos_x, pos_y, pos_z; } pos[keys]; pos[keys] is an array of the above struct. How would I use fread to get this data? I have only used fread to get integer data in my code so far. Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
Well if you call your struct something like

struct pos_t {
short framenum;
long unknown;
float pos_x, pos_y, pos_z;
} pos[keys];

You can read it with fread like this ...

fread(pos, sizeof(pos_t), keys, file);

... where file is an open file. Check out the MSDN reference here.

Edit: fixed link

[edited by - Mr_Burns on May 2, 2002 11:17:15 PM]

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!