CONTENTS | INDEX | PREV | NEXT
perror
NAME
perror - output error message associated with errno and text to stderr.
SYNOPSIS
#include <stdio.h>
void perror(str);
const char *str;
FUNCTION
perror outputs the specified string, a colon, and the error number
and error message associated with the current value of errno to
stderr, ending with a newline. perror is a common way to generate
error messages due to IO failures.
EXAMPLE
#include <stdio.h>
main()
{
FILE *fp = fopen("T:DoesNotExist", "r");
if (fp) {
puts("T:DoesNotExist isn't supposed to exist!");
exit(1);
}
perror("fopen");
return(0);
}
INPUTS
char *str; string message to include in error output
RESULTS
none
SEE ALSO