Pointers and Linked lists

How would u write an function that Write_records using an Linked list?

looks like
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void write_records(SalesRecordPtr head, int n)   // Save records to file
                                                      
{  char      outfilename[MAX_FILE_NAME + 1];   // Name of file for output records
   ofstream  out;                              // Output file stream

   cout << "\n\nI need the output file name." << endl;
   open_output(out, outfilename);              // Get file name & open file

   
   
   if (out.good())
   {  out << n << endl;       
      int i;
      for(i = 0; i < n; i++) 
      {  head[i].write(out);  
      }
      out.close();
   }
   else
   {  cout << "\a\nUnable to save data!" << endl;
   }
<--- this is the dynamic array version of it need to change it to an linked list
This is a great place to start with linked lists. - http://richardbowles.tripod.com/cpp/linklist/linklist.htm
Topic archived. No new replies allowed.