Hi ,
I want to write a structure which has a list of integer id. The list can be of varying length.
typedef struct ss_iidx_node {
int totalFreq;
vector < int > docIDList;
}s_iidx_node;
Now, I wish to write this structure in a file and read it back. How can I do it?
Wrting is done:
fwrite(&obj,sizeof(s_iidx_node),1,dat_fd2);
When I read it back, it gives garbage value. It seems it storing only the strating and ending position of stl vector...which on reading is garbage? Any idea how to do it
Thanks