The use of eof() function helps in detecting the end of file.
Your experience on this site will be improved by allowing cookies. Read Cookie Policy