•After a program has read the last piece of data from an input file, the computer is at the end of the file
(EOF).
•If we try to input any more values, the stream goes into
the fail state.
•We can use the failure of the input stream as a
sentinel.
•Example:
– inData >> intVal;
– while (inData)
– {
–
cout << intVal << endl;
–
inData >> intVal;
– }