c++ - Reading Linked List from txt file (comma separated) -
i wondering what's best way read linked list text file?
i've got write file system working, i'm unsure of how can "reverse" such , populate linked list?
he's current write file code:
void linkedlist::writefile() { ofstream myfile; node* thisnode = head; myfile.open("example.txt"); { myfile << thisnode->shape<< ","; myfile << thisnode->colour << ","; myfile << thisnode->size << ","; myfile << thisnode->type << ","; myfile << thisnode->volume << ","; myfile << thisnode->density << ","; myfile << thisnode->capacity << ","; myfile << "\n"; thisnode = thisnode->nextnode; } while (thisnode != null); myfile.close(); }
i'm open suggestions! :)
thanks.
Comments
Post a Comment