You can use feof like this.
#open a file
fd = fopen (testFile,"r+b");
#read some data from file
fread (&buff, 1, 1, fd);
..
..
..
#To check if you are at the end of file
if (feof (fd))
{
printf("This is end of file");
}else{
printf("File doesn't end. Do continue...");
}