Creating a linked list in memory from a binary file of self referential objects C++ -


After reading from a file I am trying to populate a linked list. It's just hanging when I run it; I know that problem & amp; Any guidance associated with the assignment (I may be wrong) will be greatly appreciated.

  course course; // This one course to read from file * Filecourses = New Course (); // read this link listed list fstream ("Courses.dat", iOS :: in | iOS :: binary); If (Read!) COAT & lt; & Lt; "Error reading from file courses. \ N" & lt; & Lt; Endl; Else {read.read (reinterpret_cast & lt; four * & gt; (& amp; curriculum), sizeof (course)); FileCourse-> SetNextCourse (& amp; curriculum); // Problem maybe here? While (Read & Read.F.) {read.read (reinterpret_cast & lt; four * & gt; (& amp; curriculum), sizeof (Course)); FileCourse- & gt; SetNextCourse (& amp; curriculum); If (head == faucet) {head = fileCourse; } And (course * tmp = head; tmp = tmp-> matchext corse;) while (tmp-> getNextCourse (=! NULL) {tmp = tmp-> matchext corus ();} tmp - & gt; SetxXTech (filecars);}}}    

  1. Is it If this is the case, tag it like this.
  2. A linked list with objects (in this case, course objects) To populate, you should know that n Objects should be allocated with new course () . How many objects are you allocating to this code?

Comments