Take a look at fread .
It will return NULL when it reads out the file....