fixing packing of structs to be written to files

Started by
1 comment, last by billybob 20 years, 9 months ago
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
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()
ok thanks, problem is somewhere else

This topic is closed to new replies.

Advertisement