OpenersNotesSection(Spacer1)Details

MLTestUTF16String() fails if the current object on the link is not a string, or if the value of the string does not match s.

MLTestUTF16String() 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 MLTestUTF16String() fails.

MLTestUTF16String() will reset the stream pointer to the expression on the link just prior to calling MLTestUTF16String()if the function fails. This operation behaves as if the programmer called MLCreateMark(link); MLTestUTF16String(…); MLSeekToMark(…).

The UTF-16 encoded string s must include a byte order mark.

The length n of the UTF-16 string s must include the byte order mark.

MLTestUTF16String() 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 testing the next expression on the link for a string */

void f(MLINK l)
{
	const unsigned short theString[9];

	theString[0] = 0xFEFF;
	theString[1] = '$'
	theString[2] = 'V';
	theString[3] = 'e';
	theString[4] = 'r';
	theString[5] = 's';
	theString[6] = 'i';
	theString[7] = 'o';
	theString[8] = 'n';

	if(! MLTestUTF16String(l, (const unsigned short *)theString,
		9))
	{ /* The next expression on the link is not $Version */ }
	else
	{ /* The next expression on the link is $Version */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLTestString(), paclet:/ref/c/MLTestString])  ▪  (NonWLLink[MLTestUCS2String(), paclet:/ref/c/MLTestUCS2String])  ▪  (NonWLLink[MLTestUTF32String(), paclet:/ref/c/MLTestUTF32String])  ▪  (NonWLLink[MLTestUTF8String(), paclet:/ref/c/MLTestUTF8String])}})}})

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