I am currently using #pragma pack(push, 1) and #pragma pack(pop) before and after a structure statement. This has worked well for me in the past. I now am getting incorrect values when reading the structure value. I believe the problem is the use of the frame structure array. I have not done this in the past.
Hello Ted, I found the problem. It was not C++ Builder it was the Freescale (NXP) compiler/linker. It did not like the frame array. Changed it so there was four sets of values with unique names and now get useful values when transferred into the PC program.
Good, but it sounds painful to work with :-) Did you try to break out that inner struct and "pragma pack" it separately?
The PacketHi and PacketLo and byteOrder fields seems to indicate that you may need to do some byte order conversion when reading/writing the data? Perhaps you should make a proper class out of it and have the in/out operators do the conversion and use the native format in the program you're making? If you do that, you don't have to worry about packing either. Here's a start (without byte order conversion since I don't know if it's fixed or if not, what endianess the byteOrder field signals):
I'll have to split it in several messages because something makes this forum says "Error
You have too many links in your message, please decrease them!". :-)