OpenersNotesSection(Spacer1)Details

MLTestUTF8Head() fails if the current expression on the link is not a function with a symbol as a head, or if the name of the symbol does not match h.

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

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

MLTestUTF8Head() 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 whether the next expression on the link is a ReturnPacket[] */

void f(MLINK l)
{
	const unsigned char packet[12];
	int arguments;

	packet[0] =  'R';
	packet[1] =  'e';
	packet[2] =  't';
	packet[3] =  'u';
	packet[4] =  'r';
	packet[5] =  'n';
	packet[6] =  'P';
	packet[7] =  'a';
	packet[8] =  'c';
	packet[9] =  'k';
	packet[10] = 'e';
	packet[11] = 't';

	if(! MLTestUTF8Head(l, (const unsigned short *)packet, 12,
		&arguments))
	{ /* read the contents of the ReturnPacket[] */ }
	else
	{ /* the head of the incoming expression is not ReturnPacket */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLTestHead(), paclet:/ref/c/MLTestHead])  ▪  (NonWLLink[MLTestUCS2Head(), paclet:/ref/c/MLTestUCS2Head])  ▪  (NonWLLink[MLTestUTF16Head(), paclet:/ref/c/MLTestUTF16Head])  ▪  (NonWLLink[MLTestUTF32Head(), paclet:/ref/c/MLTestUTF32Head])  ▪  (NonWLLink[MLGetArgCount(), paclet:/ref/c/MLGetArgCount])}})}})