Skip to main content
Improved grammar
Source Link
Toby Speight
  • 88.7k
  • 14
  • 104
  • 327

regardingRegarding these kinds of statements:

fprintf(stderr, "\n%s is not a valid file or permission denied\n", src);

whenWhen the error indication is from a C library function, we should call

perror( "my error message" );

as that outputsThat will output to stderr, both your error message AND the text reason the system thinks the error occurred.

regarding these kinds of statements:

fprintf(stderr, "\n%s is not a valid file or permission denied\n", src);

when the error indication is from a C library function, should call

perror( "my error message" );

as that outputs to stderr, both your error message AND the text reason the system thinks the error occurred

Regarding these kinds of statements:

fprintf(stderr, "\n%s is not a valid file or permission denied\n", src);

When the error indication is from a C library function, we should call

perror( "my error message" );

That will output to stderr both your error message AND the text reason the system thinks the error occurred.

Source Link
user3629249
  • 2.9k
  • 12
  • 10

regarding these kinds of statements:

fprintf(stderr, "\n%s is not a valid file or permission denied\n", src);

when the error indication is from a C library function, should call

perror( "my error message" );

as that outputs to stderr, both your error message AND the text reason the system thinks the error occurred