MLUTF16ErrorMessage (C 函数)
MLUTF16ErrorMessage 已经被 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.
更多信息
- 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.
范例
基本范例 (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);
}