Hi.
I was asked to write, as a class exercise, a program that gets as parameter two files paths and determines whether or not these two files are identical. it should return 1 if they are, and 0 if they're not.
So I wrote a function, and it works properly, I'm just not sure how to handle the errors;
The function makes some system calls (open()/read()...), now, what is the right way of the two to handle errors that might be caused by the system calls, should I:
1. Call perror() from within the function to notify the user about the error.
2. Return -1 from the function to main(), and let main() makes the call for perror.
On one hand, calling perror() from within the function can be more informative, on the other hand, I'm almost sure that functions do not suppose to print anything, and that it's considered bad practice.
Thanks.