if an error has occurred, take proper action

if(fr_ptr == NULL)

{

printf("Can not open");

exit(-1);

}