if an error has occurred, take proper action
if(f_ptr == NULL)
{
printf("Can not open");
exit(-1);