Original Post
What do you think is the best way to save and load linked lists from a file.
Saving the list is actually the easy part. Just soemthing like
and i believe this will work. but when you are loading from a file, I am thinking that you will need some info at the start of the file to tell how many nodes of data are in the file ?
Like have a file header that contains how many items in the list ?
Or is there a better way ?
"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions
Node* temp = myHead;
while(temp){
outfile.write((char*)&temp->data, sizeof(data));
temp = temp->link;
}
|