How would one take a struct that contained multiple other structs, amongst bools, ints etc, and flatten it into say text form?
struct Person {
struct eye_data eyes;
struct nose_data nose;
struct ear_data ear;
int height;
int weight;
bool alive;
}
The scenario under which I am operating is: Say Person A wants to send over the struct that they created and used, over to Person B, but the individual configurations of the struct are too many to send over via email or something.
How would I write a dump function in order to be able to say, write all the struct information to a text file, which can later be parsed by another program to be read back in, to create a struct.
Also, how would this change if the struct Person contained pointers to structs, ie:
struct Person {
struct eye_data *eyes;
struct nose_data *nose;
struct ear_data *ear;
int *height;
int *weight;
bool alive;
}