Here is my original post: Program crashes after opening file
I've tried again and again to fix my code, but it still either crashes or runs uncontrollably. I have yet to find a solution.
Here is my updated code:
while(!intInputFile.eof())
{
intNode* anotherInt;
anotherInt = new intNode;
if(intList==NULL)
{
intList = anotherInt;
lastInt = anotherInt;
}
else
{
lastInt->nextNode = new intNode;
lastInt = lastInt->nextNode;
lastInt->nextNode = NULL;
}
lastInt->intValue = fileInt;
lastInt = lastInt->nextNode;
lastInt->nextNode = NULL;
intInputFile >> fileInt; // *** Problem occurs on this line. ***
}