I am working on a tool in windows c++. I have a c++ structure which has the following format Code: typedef struct node { int open; int version; const unsigned long long * data; char* flags; }_node; It is a handle to a binary file. I am doing API interception and I get this pointer from an internal API call being made by the application. Also The data field in the structure above is a pointer to instances of two structures laid out contiguously. The two structures are as follows. Code: typedef struct header{ unsigned int open; unsigned int version; unsigned long long int length; } _header; Code: typedef struct body{ unsigned int v1, v2, v3, v4, v5, v6, v7, v8, v9, v10; unsigned long long int ll1, ll2; } _body; I am able to access and print the data field as follows. Code: _node* First=(node *)address;//Address is a pointer that i get from intercepting an application _header* nodeHeader=(_header*)First->data; char *bodyPtr=(char *)(nodeHeader+1); _body* nodeBody=(_body *)(bodyPtr); unsigned long long int offset=0; while(!(nodeBody->v1 & 1) && offset< nodeHeader->length) { nodeBody=(_body*)(bodyPtr+offset); offset=nodeBody->v2+nodeBody->v3; } I want to write the struct node instance into a text file and be able to read it back into a struct instance later. What is the best way to do it? I want an answer in c++ I want a c++ code because the code I am working on is in c++. The code i posted here has typedef because people who wrote the structure has written it in C.