Advertisement
Guest User

Untitled

a guest
May 29th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. //constructor that realizes date and person info from appts.txt and creates an appointment list------------
  2. ToDo::ToDo(Family* famList)
  3. {
  4.     numCells = 0; head = NULL; scan = NULL; follow = NULL;
  5.    
  6.     cout << "\nCreating ToDo...\n";
  7.     cout << "\nChecking for appts.txt file...\n";
  8.  
  9.     ifstream apptFile("c:\\appts.txt");
  10.     if(apptFile.is_open())
  11.     {
  12.         cout << "\nFile found.\n";
  13.         cout << "\nRealizing appt.txt...\n";
  14.  
  15.         for(int k = 0;! apptFile.eof();++k)
  16.         {
  17.             time_t time;
  18.             char s1[SHRTNAME];
  19.             Appointment* a;
  20.            
  21.             apptFile >> time;
  22.             apptFile >> s1;
  23.  
  24.             Date d(time);
  25.             Person p = famList->search(s1);
  26.             a = new Appointment(&p, d);
  27.             cout << "\nAdd appt...\n";
  28.             addAppt(a);
  29.  
  30.             print(cout);
  31.         }
  32.     }
  33.  
  34.     else
  35.         cout << "\nFile not found.\n";
  36.  
  37.     apptFile.close();
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement