I have seen both ways for reading file error messages. Is one better than the other? Is exit(0) better than return 1 or vice versa?
FILE *fp;
fp = fopen(argv[1], "r"); //Open file for read.
if(!fp)
{
printf("Error opening file %s!",argv[1]); //Program prints error message and closes if file is not found.
exit(0);
}
FILE *input;
input = fopen (argv[1],"r");
if (input == NULL)
{
printf("Error while opening the file.\n");
return 1;
}