perror
Header: <stdio.h>
Prints a textual description of the error code currently stored in the system variable errno to stderr.
# Declarations
void perror( const char *s );
# Parameters
s: pointer to a null-terminated string with explanatory message
# Return value
(none)
# Example
#include <stdio.h>
int main(void)
{
FILE *f = fopen("non_existent", "r");
if (f == NULL) {
perror("fopen() failed");
} else {
fclose(f);
}
}