Everything

perror


Generate the error message

[Classification]

Standard library

[Syntax]

#include <stdio.h>

void __far perror(const char __near *s);

void __far p_COM_error_f(const char __far *s);

[Description]

This function outputs to stderr the error message that corresponds to global variable errno.

stderr which is the same as stdout becomes P0 which is SFR. It is output to SFR using the putchar function.

The message that is output is as follows.

When s is not NULL

printf("%s:%s\n", s, s_fix);

When s is NULL

printf("%s\n", s_fix);

 

s_fix is as follows.

When errno is 0

"No error"

When errno is EDOM

"EDOM error"

When errno is ERANGE

"ERANGE error"

Otherwise

"Unknown error"

[Caution]

-

Note that replacing the putchar function will also change stderr. To change the output destination of stderr to something other than stdout, replace the perror function.