
------------------------------------------------------------------------------
6.40 Print error message. <Main>
------------------------------------------------------------------------------
[Name]
perror
[Syntax]
#include <stdio.h>
void perror( const char *string ) ;
[Arguments]
string Error message to be displayed.
[Return]
------
[Description]
Displays an error message to the standard error output (stderr).
"string" is displayed first, then a colon (':') and a system error
message about the library call which has been occurred the latest
error, and last a newline is output. If "string" is NULL pointer or
a pointer to null string, only system error message is displayed. A
error code is stored in a global variable "errno" defined in errno.h.
A system error message is read from "sys_errlist", an array of
messages sorted by error code. "perror" function uses "errno" as a
index of "sys_errlist" to display an error message. "sys_nerr"
variable is the maximum element number of "sys_errlist" array. It is
necessary to call "perror" function just after library error to
display exactly. Otherwise, the following library calls may overwrite
"errno". Values which are stored in "errno" at error are original
ones of C Executor. These are not compatible with any PCs (MS-DOS
machines, etc.) and may be changed in the future. So, programming
that "errno" is handling is not recommended because it may not works
correctly in the future.