I have recently made a game in OpenGL. I want to program a Quicksave and Quickload feature. The problem is this: My game consists of classes and the main class contains a cyclic linked list of the world environment and enemies. I have no clue on how to write this info to a data file.
CEntity *worldObjs; // cyclic linked list
I attach nodes to the base CEntity class through my linked list. Unfortunately the command:
fwrite(world, sizeof(CWorld),1, fp);
does not work when I try to load it:
fread(world, sizeof(CWorld),1, fp);
Must I loop through each object of the linked list and save each one individally? This is tedious and I think there must be a better way. Besides, each object has its own pointers etc. which means I may have to loop through each pointer of each object in the list; I do NOT want to resort to this. Plz help?