Class oerror
Introduction
This class implements a standard means of displaying system error messages. Class methods may be replaced or adapted to support either a console or a windowing environment.
This class is declared in oerror.hpp and defined in oerror.cpp.
Dependence
This references header file types.h to define data type errno_t
.
This classes references external character string program_name which must be defined and initialized somewhere in the environment. The simplest method is to define a global constant character pointer to the basename of argv[0] in function main().
Methods
oerror::error
oerror & oerror::error
signed status
errno_t number
errno_t format
...
Print an error message on stderr and optionally terminate the program. The message consists of the program name, system error message and a program error message. This method behaves the same as the GNU/Linux error function.
status
The program exit status. if status is 0 then this method will return to the caller after printing an error message. Otherwise, the program will exit with this value after printing the message.
errno
The error code. This is normally the value of global variable errno set by system functions to indicate the cause of an error condition. If argument number is 0 then no system error message is printed. Otherwise, the system error message will appear
format
The format string. The content is the same as required by standard library function printf().
...
A variable length argument list. On GNU/Linux systems, the gcc compiler checks to ensure the number and type of each argument actually match the corresponding format string specification.