In the last chapter of Prata, C++ Primer Plus, p. 1001, he has the following code:

Code:
while(cin.peek() != '#')
	{
		cin.get(c);
		cout << c;
	}
	if (!cin.eof())
	{
		cin.get(c);
		cout << endl << c << " is next input character.\n";
	}
	else
		cout << "End of file reached.\n";
when would it be the case that with the usual keyboard input, eofbit is set? The fact that he writes the code this way suggests that it can happen... ?