WSUTF32ErrorMessage (C Function)

const unsigned int * WSUTF32ErrorMessage(WSLINK l, int *n)

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

Details

  • WSUTF32ErrorMessage() allocates memory for the message string that must be released. Use WSReleaseUTF32ErrorMessage() to release the memory allocated by WSUTF32ErrorMessage(). If WSUTF32ErrorMessage() returns NULL, do not call WSReleaseUTF32ErrorMessage() on the NULL value.
  • Programs should not modify the contents of the error message string.
  • The string returned by WSUTF32ErrorMessage() contains a platform-appropriate byte order mark.
  • The length of the string n includes the byte order mark.
  • WSUTF32ErrorMessage() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

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

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

    message = WSUTF32ErrorMessage(l, &length);

    /* We check for length <= 1 because WSUTF32ErrorMessage() returns
    a byte order mark. */

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

    /* ... */

    WSReleaseUTF32ErrorMessage(l, message, length);
}