Incomplete File type, what does this mean?

I was debugging my program that is supposed to read in values from a .txt file. When I was looking at the local variables, by intInputFile it says <incomplete>. I'm not sure what this means? Could this be why my program is looping uncontrollably? I put in a cout << "good"; statement to see if the execution will reach that area, and now when I run it, it says "good" repeatedly. Any help please?

Thanks.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 intInputFile >> fileInt;
    cout << "check" <<endl;
    while(!intInputFile.eof())
    {
        intNode* anotherInt;
        anotherInt = new intNode;
       if(intList==NULL)
       {
           intList = anotherInt;
           lastInt = anotherInt;
           lastInt->nextNode = NULL;
           lastInt->nextNode = new intNode;
       }
       else
       {
          lastInt = lastInt->nextNode;
          lastInt->nextNode = NULL;
          lastInt->nextNode = new intNode;
       }
       lastInt->intValue = fileInt;
       intInputFile >> fileInt;
       cout << "good" <<endl;
Could this be why my program is looping uncontrollably?

The reason is while(!intInputFile.eof()), which is an unfortunately common error: this loop condition does not check if the most recent input attempt failed for one of the reasons that don't involve reading past the end of file. For example, if your file contains data that cannot be parsed as an integer, you will loop forever.

The canonical C++ input loop is while(intInputFile >> fileInt).
You're right, it stopped looping uncontrollably when I changed it to while(intInputFile >> fileInt). But does this mean I would have to remove intInputFile >> fileInt?

Thank you.
Topic archived. No new replies allowed.