STRERROR

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
BSD 4  

NAME

perror strerror sys_errlist sys_nerr - system error messages  

SYNOPSIS

Vt extern int errno; Vt extern char *sys_errlist[]; Fd #include <stdio.h> Ft void Fn perror const char *string Ft char * Fn strerror int errnum  

DESCRIPTION

The Fn strerror and Fn perror functions lookup the error message string affiliated with an error number.

The Fn sterror function accepts an error number argument Fa errnum and returns a pointer to the corresponding message string.

The Fn perror function finds the error message corresponding to the current value of the global variable errno and writes it, followed by a new-line, to the stderr If the argument Fa string is non- NULL it is pre-appended to the message string and separated from it by a colon and space (`:' ) If Fa string is NULL only the error message string is printed.

The message strings can be accessed directly using the external character array Fa sys_errlist . The external value Fa sys_nerr contains a count of the messages in Fa sys_errlist . The use of these variables is deprecated; Fn strerror should be used instead.  

SEE ALSO

intro(2), psignal(3)  

HISTORY

The Fn strerror and Fn perror functions are Ud .


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
HISTORY

This document was created by man2html, using the manual pages.
Time: 06:40:34 GMT, May 19, 2025