VistaIOSetWarningHandler(3) register a procedure to be called on any nonfatal error

SYNOPSIS

void VistaIOSetWarningHandler (VistaIOWarningHandler *handler)
typedef void VistaIOWarningHandler (VistaIOStringConst message);
void VistaIODefaultWarning (VistaIOStringConst message);

ARGUMENTS

handler
Specifies the new nonfatal error handler.
message
Specifies a null-terminated error message string to be reported.

DESCRIPTION

VistaIOSetWarningHandler registers a procedure, handler, as the nonfatal error handler. That procedure is called by VistaIOWarning(3) or by VistaIOSystemWarning(3) to report any nonfatal error. When called it is passed a string, message, containing a textual description of the error.

Only one procedure serves as the nonfatal error handler at any one time.

Prior to the first call to VistaIOSetWarningHandler, the procedure VistaIODefaultWarning is the nonfatal error handler. This procedure will write the error message to the standard error stream, then return. VistaIODefaultWarning can be re-established as the fatal error handler at any time by calling VistaIOSetWarningHandler with a NULL argument.

EXAMPLES

To adopt a warning handler that writes messages both to the standard error stream and to a log file, one might do the following:

FILE *log_file;
void MyWarningHandler (message)
        VistaIOStringConst message;
{
        fputs (message, stderr);
        fputs (message, log_file);
}
int main (...)
{
        ...
        log_file = fopen ("log", "w");
        VistaIOSetWarningHandler (MyWarningHandler);
        ...
}

AUTHOR

Art Pope <[email protected]>

Adaption to vistaio: Gert Wollny <[email protected]>