OpenersNotesSection(Spacer1)Details

WSTestUTF16Head() 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.

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

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

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

The UTF-16 encoded head h must include a byte order mark.

The length v of the UTF-16 encoded head h must include the byte order mark.

WSTestUTF16Head() is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "wstp.h"

/* A function for testing whether the next expression on the link is a ReturnPacket[] */

void f(WSLINK l)
{
	const unsigned short packet[13];
	int arguments;

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

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

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSTestHead(), paclet:ref/c/WSTestHead])  ▪  (NonWLLink[WSTestUCS2Head(), paclet:ref/c/WSTestUCS2Head])  ▪  (NonWLLink[WSTestUTF32Head(), paclet:ref/c/WSTestUTF32Head])  ▪  (NonWLLink[WSTestUTF8Head(), paclet:ref/c/WSTestUTF8Head])  ▪  (NonWLLink[WSGetArgCount(), paclet:ref/c/WSGetArgCount])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Expressions, paclet:guide/WSTPCFunctionsForExchangingExpressions])}})}})