I have some beginners questions about file handing and loops. For example, lets say the file contains words and integers. And the logic is to read only the integers from the file. I know the outer loop ends when the pointer is at end of file. But I don't know the conditions that causes the inner loop to break. Does the loop break if it encounters words? if so does it set the file pointer to next line or does the file pointer not move? If the inner loops fails to run the first time, where does it set the file pointer?
here is what's on the file.
some words 11 12 15 14 15 some words 122
some words 45 1 12 2135 words
//here is the logic
int someInt = 0, counter = 0;
while (!file.eof()) //Runs until end of file
{
while(file >> someInt) //only reads integers. when does this loop break?
{
counter++;
}
}