MLUTF32ErrorMessage (C Function)

MLUTF32ErrorMessage has been replaced by WSUTF32ErrorMessage.

const unsigned int * MLUTF32ErrorMessage(MLINK l, int *n)

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

Details

  • MLUTF32ErrorMessage() allocates memory for the message string that must be released. Use MLReleaseUTF32ErrorMessage() to release the memory allocated by MLUTF32ErrorMessage(). If MLUTF32ErrorMessage() returns NULL, do not call MLReleaseUTF32ErrorMessage() on the NULL value.
  • Programs should not modify the contents of the error message string.
  • The string returned by MLUTF32ErrorMessage() contains a platform-appropriate byte order mark.
  • The length of the string n includes the byte order mark.
  • MLUTF32ErrorMessage() 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 int *message;
    int length;

    message = MLUTF32ErrorMessage(l, &length);

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

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

    /* ... */

    MLReleaseUTF32ErrorMessage(l, message, length);
}