Jump to content
  • Advertisement

Archived

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

billybob

fixing packing of structs to be written to files

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

What is the correct packing to build a struct to write it to a file, (a TGA header right now). its unopenable right now, and I''m almost positive its the packing. #pragma pack(push, 1) ... #pragma pack(pop) doesn''t work, am I doing it wrong? it doesn''t appear wrong according to MSDN, its the 1 i''m not sure about. i searched for TGA readers/writers, they all just write each part one by one. I don''t really mind doing it that way, i''d just like to know why my packing code doesn''t work. thanks for the help

Share this post


Link to post
Share on other sites
Advertisement
i''m doing it like this:

#pragma pack(1)
...
#pragma pack()

alternatively, you can do it like this (i think...)

#pragma pack(1)
...
#pragma pop()

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!