I was wondering if someone could explain to me what the #pragma pack preprocessor statement does, and more importantly, why one would want to use it.
I
Compiler could align members in structures to achieve maximum performance on the certain platform. #pragma pack directive allows you to control that alignment. Usually you should leave it by default for optimum performance. If you need to pass a structure to the remote machine you generally will use #pragma pack 1 to exclude any unwanted alignment.