In C/C++, we can write a struct to file like this:
#include <stdio.h>
struct mystruct
{
int i;
char cha;
};
int main(void)
{
FILE *stream;
struct mystruct s;
stream = fopen("TEST.$$$", "wb"))
s.i = 0;
s.cha = 'A';
fwrite(&s, sizeof(s), 1, stream);
fclose(stream);
return 0;
}
But how to wirte a struct to file in go or python ? I want the data in struct are continuous.