Gets the code corresponding to the error message from the last function called.
#include <imsls.h>
long imsls_error_code ( )
This function returns the error message code from the last function called. The include file imsls.h defines a name for each error code.
In this example, stopping on IMSLS_TERMINAL error messages is turned off and an error is then generated by calling function imsls_error_options with an illegal value for IMSLS_SET_PRINT. The error message code number is then retrieved and printed. In imsls.h, IMSLS_INTEGER_OUT_OF_RANGE is defined to be 132.
#include <imsls.h>
#include <stdio.h>
int main()
{
long code;
/* Turn off stopping IMSLS_TERMINAL */
/* messages and print error messages */
/* on standard output */
imsls_error_options(IMSLS_SET_STOP, IMSLS_TERMINAL, 0,
IMSLS_SET_ERROR_FILE, stdout,
0);
/* Call imsls_error_options() with */
/* an illegal value */
imsls_error_options(IMSLS_SET_PRINT, 100, 0,
0);
/* Get the error message code */
code = imsls_error_code();
printf("error code = %d\n", code);
}
*** TERMINAL error from imsls_error_options. "type" must be between 1 and
*** 5, but "type" = 100.
error code = 132