Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>perror</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
perror

Usage

   #include <stdlib.h>
   void perror(char *msg);

   ANSI

Description

   Displays a message on the standard output describing the last error that
   occurred in a system call or library function call. The argument msg is
   printed first, then a colon, followed by the error description.

Example 

   #include <stdio.h>
   #include <stdlib.h>

   int main()
   {
       FILE *fp;
       char *string = "Error message";
       if((fp = fopen("file.dat","r")) == NULL) {
           perror(string);
           return EXIT_FAILURE;
       } else
           printf("File open for reading\n");
       fclose(fp);
       return EXIT_SUCCESS;
   }

See Also

   strerror




See Also: strerror

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson