Say I have
struct S{
int m[10];
};
I can easily save this to a file by simply using:
S s;
file.write(reinterpret_cast<char*>(&s), sizeof(S));
But what if I have dynamic arrays within the struct? Is there an easier way to save a struct with arrays to a file, without having to iterate over each element within each array in the struct?
struct S2{
int *p;
int *t;
};
Sdoesn't manage endianess.