I was just wondering if anyone could explain what is happening in the following bit of code. I know that the code will keep getting data from the file and outputting it to the screen @ a char @ a time, but on each itteration of the loop how does the program know which character it should be outputting next. I understand it will stop once the end of file is reached, but how is the code keeping a count of which character should be displayed?
void main()
ifstream InFile;
char InChar;
InFile.open("Test.txt");
InFile >> InChar;
while(!InFile.eof())
{
cout << InChar << endl;
InFile >> InChar;
}
InFile.close();
getchar();
}