On Tue, Jan 6, 2009 at 12:07 AM, Jos Timanta Tarigan
<[email protected]> wrote:
> Hi,
>
> i notice this line:
>
> #pragma pack(push,1)
> struct TGAHeader {
>
> bla bla bla...
>
> };
> #pragma pack(pop)
>
> what is the definition of pragma exatly?

It's for compiler specific features. From the context (it's using
something called pack(), and it's containing a struct definition) at a
guess it removes all struct padding.

> i use this struct as a header that will be written in a file. when i delete 
> this line, the file can
>  not be opened by the application (corrupted). can any1 help me?

Removing the pragma will result in struct padding being reinstated,
resulting in the struct taking up more memory.

I'm guessing that the program writes the struct to file in one go (as
opposed to member by member.)


-- 
PJH

http://shabbleland.myminicity.com

Reply via email to