Hi, I'm trying to load a file into a structure. Well actually, a structure and a 3d array of structures. Very confusing for somebody like me. Here's what everything looks like.
The array of MAPTILES is all allocated dynamically with one of the member functions. I have a load function already set-up but when I made the MAPFILEHEADER struct to use for saving maps I figured I could just save all my structures in one big blob, instead of looping through each element. Because I have a muliti-dimensional array of structs and because it's all allocated dynamically this has gotten me very confused. Could somebody please explain how I would go about writing this to a file? Some pseudo-code would be nice. Thanks in advance.Code:struct MAPFILEHEADER { double engversion; char *tileset; char *name; char *leftexit; char *rightexit; char *downexit; char *upexit; int width; int height; } struct MAPTILE { int id; int width; int height; }; class mapObj { public: // bunch of methods // ...... private: MAPFILEHEADER mapheader; MAPTILE **tile[2]; // lots of other private members. // ........ };



LinkBack URL
About LinkBacks



I'll give it a try.
I used to be an adventurer like you... then I took an arrow to the knee.