CNLMath : Utilities : error_code
error_code
Gets the code corresponding to the error message from the last function called.
Synopsis
#include <imsl.h>
long imsl_error_code()
Return Value
This function returns the error message code from the last IMSL function called. The include file imsl.h defines a name for each error code.
Example
This example turns off stopping on IMSL_TERMINAL error messages and generates an error by calling imsl_error_options with an illegal value for IMSL_SET_PRINT. The error message code number is retrieved and printed. In imsl.h, IMSL_INTEGER_OUT_OF_RANGE is defined to be 132.
 
#include <imsl.h>
#include <stdio.h>
 
int main()
{
long code;
/* Turn off stopping IMSL_TERMINAL */
/* messages and print error messages */
/* on standard output. */
imsl_error_options(IMSL_SET_STOP, IMSL_TERMINAL, 0,
IMSL_SET_ERROR_FILE, stdout,
0);
/* Call imsl_error_options() with */
/* an illegal value */
imsl_error_options(IMSL_SET_PRINT, 100, 0,
0);
/* Get the error message code */
code = imsl_error_code();
printf("error code = %d\n", code);
}
Output
 
*** TERMINAL Error from imsl_error_options."type" must be between 1 and 5,
*** but "type" = 100.
 
error code = 132