WSUCS2ErrorMessage (C Function)

const unsigned short * WSUCS2ErrorMessage(WSLINK l, int *n)

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

Details

  • WSUCS2ErrorMessage() allocates memory that must be released by calling WSReleaseUCS2ErrorMessage().
  • WSUCS2ErrorMessage() 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 short *message;
    int length;

    message = WSUCS2ErrorMessage(l, &length);
    if(message == (const unsigned short *)0 || length == 0)
    { /* Unable to get the error message from the link */ }

    /* ... */

    WSReleaseUCS2ErrorMessage(l, message, length);
}