OpenersNotesSection(Spacer1)Details

MLGetUCS2Symbol() allocates memory for the character string. You must call (NonWLLink[MLReleaseUCS2Symbol(), paclet:ref/c/MLReleaseUCS2Symbol]) to disown this memory. If MLGetUCS2Symbol() fails and the function's return value indicates an error, do not call (NonWLLink[MLReleaseUCS2Symbol(), paclet:ref/c/MLReleaseUCS2Symbol]) on the contents of s.

MLGetUCS2Symbol() returns immutable data.

MLGetUCS2Symbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.

Use (NonWLLink[MLError(), paclet:ref/c/MLError]) to retrieve the error code if MLGetUCS2Symbol() fails.

MLGetUCS2Symbol() 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"

/* read a UCS-2 encoded symbol from a link */

void f(MLINK lp)
{
	const unsigned short *symbol;
	int len;

	if(! MLGetUCS2Symbol(lp, &symbol, &len))
		{
			/* unable to retrieve the UCS-2 symbol */
			return;
		}

	/* ... */

	MLReleaseUCS2Symbol(lp, symbol, len);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLGetSymbol(), paclet:ref/c/MLGetSymbol])  ▪  (NonWLLink[MLGetByteSymbol(), paclet:ref/c/MLGetByteSymbol])  ▪  (NonWLLink[MLGetUTF8Symbol(), paclet:ref/c/MLGetUTF8Symbol])  ▪  (NonWLLink[MLGetUTF16Symbol(), paclet:ref/c/MLGetUTF16Symbol])  ▪  (NonWLLink[MLGetUTF32Symbol(), paclet:ref/c/MLGetUTF32Symbol])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(RefLinkPlain[Handling Lists, Arrays and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}})}})