Tutorials Shared by the Internet Community
|Top Tutorials||New Tutorials||Submit||Login||Register|
Tutorial Basic Detail
Total Hits: 11698
Total Votes: 139 votes
Average Rating: 2.81 out of 5
Category: C and C++/File Manipulation
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.