The examples in the C API Help use the ErrorHandler function to process errors. If required, you can create a function to handle your application's errors, based on ErrorHandler.
Function: ErrorHandler ( SHORT, CHARPTR )
# define MAX_LOG 100
void EPOINT ErrorHandler ( SHORT nErrorCode, CHARPTR lpszMessage )
{
char lpszErrorString[2*MAX_LOG];
char lpszBuffer[MAX_LOG];
lpszErrorString[0] = '\0';
lpszBuffer[0] = '\0'; // Set lpszBuffer string to NULL just in case there is no error
/* Generate the error string */
if ( nErrorCode != IN_SUCCESS ) {
IN_GetErrorMessage( nErrorCode, (SHORT)MAX_LOG, lpszBuffer );
sprintf( lpszErrorString, "%s (%d) %s", (CHARPTR)lpszMessage, nErrorCode, (CHARPTR)lpszBuffer );
} else {
sprintf( lpszErrorString, "%d %s", nErrorCode, (CHARPTR)lpszMessage );
}
/* Now that the error string has been built you can place code here to do something with the error string, such as sending it to a log file. */
}
See also