WSUTF8ErrorMessage (C Function)

const unsigned char * WSUTF8ErrorMessage(WSLINK l, int *n)

returns a string of length n encoded in the UTF-8 character encoding form describing the last error to occur on the WSTP connection specified by l.

Details

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

Examples

Basic Examples  (1)

#include "wstp.h"

/* A function for reading the error message of a link */

void f(WSLINK l)
{
    const unsigned char *message;
    int length;

    message = WSUTF8ErrorMessage(l, &length);

    if(message == (const unsigned char *)0 || length == 0)
    { /* Unable to read the error message from the link */ }

    /* ... */

    WSReleaseUTF8ErrorMessage(l, message, length);
}