Chapter 15: Utilities > error_message

error_message

Gets the text of the error message from the last function called.

Synopsis

#include <imsls.h>

char *imsls_error_message ()

Return Value

Returns the current error message.

Description

If the current error type is positive then the last error message set is returned. It does not matter if the error message was printed or not. The current error type is the number returned by imsls_error_type.  If the current error type is zero then NULL is returned.

The returned string can be freeed using imsls_free.

Example

This example retrieves the error message from a call to imsls_f_wilcoxon_rank_sum with an illegal argument.

#include <imsls.h>

#include <stdio.h>

 

int main(void)

{

    char   *msg;

    float  x[] = {0, 1, 2};

    float  y[] = {0, 1, 2};

    float  p;

 

    p = imsls_f_wilcoxon_rank_sum (3, x, 3, y, 0);

    msg = imsls_error_message();

    printf("type = %d\ncode = %d\nmsg = %s\n",

        imsls_error_type(), imsls_error_code(), msg);

    imsls_free(msg);

Output

 

*** WARNING  Error IMSLS_AT_LEAST_ONE_TIE from imsls_f_wilcoxon_rank_sum.

***          At least one tie is detected between the samples.

 

type = 3

code = 11123

msg = At least one tie is detected between the samples.


RW_logo.jpg
Contact Support