Detecting End-of-file - C++
|Top Tutorials||New Tutorials||Submit||Login||Register|
Total Hits: 15686
Total Votes: 142 votes
Category: C and C++/File Manipulation
Submitted on: 2008-04-16 01:55:05
Submitted By: Shekhar
Description:Detection of End-of-file condition is necessary for preventing any further attempt to read data from the file. The end-of-file can be detected in two ways. The examples shows the two ways in which the end-of-file can be detected. While loop terminates when last returns a value of zero on reaching the end-of-file condition. The loop may also terminate due to otherfailures as well. eof() is a member of ios class. It returns a non-zero value if the end-of-file(EOF) is encountered and a zero otherwise. More detail...