Dumping data structures binary into a file
-
In Python there is a method called CPickle which will dump data structures into a binary file. that way many executables could share a data structure. It was accomplished using C. Does anyone know how this could be achieved for MFC's template data structures. -JD
-
In Python there is a method called CPickle which will dump data structures into a binary file. that way many executables could share a data structure. It was accomplished using C. Does anyone know how this could be achieved for MFC's template data structures. -JD
If it's just data, then no problem If they're classes, with virtual functions, then it's a big problem. Part of your data includes the virtual function table, which will not be the same between processes (or even between invocations of the same program). Simply: fwrite(&data, sizeof(data), 1, file); -- Where are we going? And why am I in this handbasket?
-
If it's just data, then no problem If they're classes, with virtual functions, then it's a big problem. Part of your data includes the virtual function table, which will not be the same between processes (or even between invocations of the same program). Simply: fwrite(&data, sizeof(data), 1, file); -- Where are we going? And why am I in this handbasket?
> If they're classes, with virtual functions [...] Or even structures with virtual functions... > If it's just data, then no problem You do, of course, need to be smart enough to consider alignment and packing issues (and sometimes endian-ness!) when dealing with reading and writing data structures in such a way. Peace! -=- James.