| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <stdio.h> void perror(const char *string); |
This function formats an error message and prints it to stderr.
The message is the string, a colon and a blank, and a message
suitable for the error condition indicated by errno.
If string is a null pointer or points to a null string,
the colon and blank are not printed.
None.
| ANSI/ISO C | C89; C99 |
| POSIX | 1003.2-1992; 1003.1-2001 |
int x = open("foo", O_RDONLY);
if (x < 0)
{
perror("foo");
exit(1);
}
|