OpenersNotesSection(Spacer1)Details

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

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

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

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

void f(WSLINK l)
{
	const unsigned char theString[8];

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

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

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSTestString(), paclet:ref/c/WSTestString])  ▪  (NonWLLink[WSTestUTF16String(), paclet:ref/c/WSTestUTF16String])  ▪  (NonWLLink[WSTestUTF32String(), paclet:ref/c/WSTestUTF32String])  ▪  (NonWLLink[WSTestUCS2String(), paclet:ref/c/WSTestUCS2String])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(RefLinkPlain[Handling Lists, Arrays, and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}, {▪(RefLinkPlain[Portability of WSTP Programs, paclet:tutorial/PortabilityOfWSTPPrograms])}, {▪(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 Data, paclet:guide/WSTPCFunctionsForExchangingData])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Strings, paclet:guide/WSTPCFunctionsForExchangingStrings])}, {▪(RefLinkPlain[WSTP C Language Functions, paclet:guide/WSTPCLanguageFunctions])}})}})