I'm trying to set up a double linked-list, that is a linked-list within a linked-list. the structure looks like this:
my problem is saving the entire structure to a file, and then being able to open it up later. Saving the initial linked-list isn't a problem. But the pointers within the first linked-list which create the second linked-list may be a problem. Also, I can't come up with a successful way to get the data from the file and back into a linked list. My initial idea was to set up an initial node, open the file, save the data from the first node to the initial node, then create a new node, save the next data to that node, and so on until the eof is encountered. The problem is getting the second linked-list into the file, and back out. Here is my attempt at saving the file:
char name ;
char pass ;
Node *node, //current node
Can anyone help me with the syntax for this file operation or point me somewhere that describes this type of problem?
void LList::SaveToFile ()
ofstream data ("data.dat");
node = list_h;
data.write((char*)node, sizeof(Node)); node = node->next; //does this write the internal linked-list as well?