perror

suggest change

To print a user-readable error message to stderr, call perror from <stdio.h>.

int main(int argc, char *argv[])
{
   FILE *fout;

   if ((fout = fopen(argv[1], "w")) == NULL) {
      perror("fopen: Could not open file for writing");
      return EXIT_FAILURE;
   }
return EXIT_SUCCESS;
}

This will print an error message concerning the current value of errno.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents