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?
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).