I am not a programmer but I had the need to write a C struct to disk
When I then tried to write another of the same files to try and work-a-round a problem with the system they are used on I got a slightly large (by 4 bytes) file
I was compiling the C program with my MacBook using Xcode version of gcc.
The fix for the extra 4 bytes was to add -fpack-struct to the gcc command line. Which stopped some sort of forced alignment to a 4 byte boundary (I think).
gcc -fpack-struct capture.c -o capture
0 Comments