![]() |
Data Abstraction and Problem Solving with C++Walls and Mirrorsby Frank M. Carrano |
![]() |
example207.cppGo to the documentation of this file.00001 00016 // Saves a linked list's data in a text file of 00017 // integers; head points to the linked list. 00018 00019 // fileName is a string that names an external text 00020 // file to be created 00021 ofstream outFile(fileName); 00022 00023 // traverse the list to the end, writing each item 00024 for (Node *cur = head; cur != NULL; cur = cur->next) 00025 outFile << cur->item << endl; 00026 00027 outFile.close(); 00028 // Assertion: The text file contains the linked 00029 // list's data in its original order. |