WSErrorMessage (C Function)

const char * WSErrorMessage(WSLINK link)

returns a character string describing the last error to occur on link.

Details

  • WSErrorMessage() allocates memory for the message string that must be released. Use WSReleaseErrorMessage() to release the memory allocated by WSErrorMessage(). If WSErrorMessage() returns NULL, do not call WSReleaseErrorMessage() on the NULL value.
  • WSErrorMessage() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* send the double precision floating-point number 3.22 to a link and print an error message if the send fails */

void f(WSLINK lp)
{
    if(! WSPutReal64(lp, 3.22))
    {
        const char *message = WSErrorMessage(lp);

        /* unable to send 3.22 to lp */
        printf("WSTP Error: %s\n", message);

        WSReleaseErrorMessage(lp, message);
    }

    /* ... */
}