OpenersNotesSection(Spacer1)Details

MLUTF8ErrorMessage() allocates memory for the message string that must be released. Use (NonWLLink[MLReleaseUTF8ErrorMessage(), paclet:/ref/c/MLReleaseUTF8ErrorMessage]) to release the memory allocated by MLUTF8ErrorMessage(). If MLUTF8ErrorMessage() returns NULL, do not call (NonWLLink[MLReleaseUTF8ErrorMessage(), paclet:/ref/c/MLReleaseUTF8ErrorMessage]) on the NULL value.

Programs should not modify the contents of the string.

MLUTF8ErrorMessage() is declared in the MathLink header file (RefLink[mathlink.h, paclet:/ref/file/mathlink.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)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);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLReleaseUTF8ErrorMessage(), paclet:/ref/c/MLReleaseUTF8ErrorMessage])  ▪  (NonWLLink[MLErrorMessage(), paclet:/ref/c/MLErrorMessage])  ▪  (NonWLLink[MLUCS2ErrorMessage(), paclet:/ref/c/MLUCS2ErrorMessage])  ▪  (NonWLLink[MLUTF16ErrorMessage(), paclet:/ref/c/MLUTF16ErrorMessage])  ▪  (NonWLLink[MLUTF32ErrorMessage(), paclet:/ref/c/MLUTF32ErrorMessage])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Error and Interrupt Handling, paclet:tutorial/ErrorAndInterruptHandling])}})}})