Stick some error-handling code in - for every
if, there should be an
else that prints out where it went wrong. For example, as a counterpart to the very first
if statement, add this to the end:
else
{
printf("ERROR: Could not open the file.\n");
return EXIT_FAIL;
}