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.
Code:
ifstream inFile;
inFile.open(fname);
if (!inFile)
{
return 0;
}
while (!inFile.eof())
{
inFile >> x
if(isdigit(x))
{
tmp[i] = x;
i++;
}