I am reading data from a file which I store in a linked list. However, for some reason when reading the list
I get an extra "node".
Here is my code.
The file I read is 10 lines long. It seems that theCode:// while not the end of the files keep reading while(!sin.eof()) { sin >> nextChar; temp->idNumber = nextChar; sin >> nextChar; temp->LastName = nextChar; sin >> nextChar; temp->FirstName = nextChar; sin >> nextChar; temp->Major = nextChar; sin >> nextChar; temp->Class = nextChar; InsertTail(temp); // insert the node count++; }
last element in the file fills an extra node up. So count prints 11 instead of 10.
I am sure the above code is the problem. Any
help would be great thanks in advance.



LinkBack URL
About LinkBacks



. Here is the full code