I'm using ifstream to scan in integers from a file, but I come into a problem when there is a character mixed up within the integer list. It will read correctly till it hits the character then loop forever on the integer before. The inFile position woun't move up. How do I fix this problem? This is my code from that section that I am having a problem with. I need to fix it so that it will see that the next value is a char and then it will break out and stop there.
x is an int, if that makes helps at all.
Code:while (!inFile.eof()) { inFile >> x; if(isdigit(x)) { tmp[i] = x; i++; } }



LinkBack URL
About LinkBacks


