MLUTF16ErrorMessage (C Function)

MLUTF16ErrorMessage has been replaced by WSUTF16ErrorMessage.

const unsigned short * MLUTF16ErrorMessage(MLINK l, int *n)

returns a character string of length n encoded in the UTF-16 character encoding that represents the message describing the last error to occur on the MathLink connection specified by l.

Details

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

Examples

Basic Examples  (1)

#include "mathlink.h"

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

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

    message = MLUCS2ErrorMessage(l, &length);

    /* We check for length <= 1 below because the string
    should contain a byte order mark */
    if(message == (const unsigned short *)0 || length <= 1)
    { /* Unable to read the error message */ }

    /* ... */

    MLReleaseUTF16ErrorMessage(l, message, length);
}