Friday, July 1, 2011

Disable structure padding in C

Following is the way to disable structure padding using pragma in C.

#pragma pack(push, 1)
//Define your structure here
#pragma pack(pop)
//Structure padding is re enabled.


More information can be found at MSDN. GCC follows the same specifications.

No comments:

Post a Comment