我想将结构数据输出到二进制文件,但每个变量的信息之间没有任何填充位.例如:
struct s {
int i1;
short s1;
char c1;
};
struct s example[2];
Run Code Online (Sandbox Code Playgroud)
如果我使用fwrite(&example, sizeof(struct s), 2, file)的二进制文件仍然之间,例如,填充比特s1和c1,也从c1到i1 (of the 2nd struct).
从输出文件中删除这些填充位的好方法是什么?
谢谢!任何帮助表示赞赏