MLUTF8ErrorMessage (C Function)

MLUTF8ErrorMessage has been replaced by WSUTF8ErrorMessage.

const unsigned char * MLUTF8ErrorMessage(MLINK 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 MathLink connection specified by l.

Details

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

Examples

Basic Examples  (1)

#include "mathlink.h"

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

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

    message = MLUTF8ErrorMessage(l, &length);

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

    /* ... */

    MLReleaseUTF8ErrorMessage(l, message, length);
}