codescracker


c

C feof()



« Previous Function Next Function »


feof()

The feof() function is used to determine whether the end of file associated with stream has be reached.

feof() Syntax

Following is the syntax of the feof() function

#include<stdio.h>
int feof(FILE *stream);

feof() returns non-zero if the file position indicator is at the end of the file, otherwise it returns zero.

Once the end of file has been reached, subsequent read operations will return EOF until either rewind() is called or the file position indicator is moved using the function fseek().

feof() Example

The following c code shows the one way to read to the end of a file (Let's assume that fp has been opened for the read operations) :

while(!feof(fp))
{
	getc(fp);
}

« Previous Function Next Function »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test