OpenersNotesSection(Spacer1)Details

WSGetNumberAsUTF32String() allocates memory to store the string value. To release the memory allocated by WSGetNumberAsUTF32String(), call (NonWLLink[WSReleaseUTF32String(), paclet:ref/c/WSReleaseUTF32String]) on the contents of s. If WSGetNumberAsUTF32String() fails, do not call (NonWLLink[WSReleaseUTF32String(), paclet:ref/c/WSReleaseUTF32String]) on the contents of s.

The UTF-32 string s returned by WSGetNumberAsUTF32String() begins with a byte order mark.

The string length n includes the byte order mark.

WSGetNumberAsUTF32String() returns 0 on error and a nonzero value if the function succeeds.

WSGetNumberAsUTF32String() 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 reading an integer from a link */

void f(WSLINK l)
{
	switch(WSGetType(l))
	{
		case WSTKINT:
		{
			int rawType;
			rawType = WSGetRawType(l);
			if(rawType == WSTK_WSSHORT)
			{
				short theNumber;
				WSGetInteger16(l, &theNumber);
				/* ... */
			}
			else if(rawType == WSTK_WSINT)
			{
				int theNumber;
				WSGetInteger32(l, &theNumber);
				/* ... */
			}
			else
			{
				const int *theNumber;
				int length;
				WSGetNumberAsUTF32String(l, &theNumber, &length);
				/* ... */
				WSReleaseUTF32String(l, theNumber, length);
			}
		}
		break;
		case WSTKREAL:
			/* ... */
	}
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSReleaseUTF32String(), paclet:ref/c/WSReleaseUTF32String])  ▪  (NonWLLink[WSGetNumberAsString(), paclet:ref/c/WSGetNumberAsString])  ▪  (NonWLLink[WSGetNumberAsUCS2String(), paclet:ref/c/WSGetNumberAsUCS2String])  ▪  (NonWLLink[WSGetNumberAsUTF16String(), paclet:ref/c/WSGetNumberAsUTF16String])  ▪  (NonWLLink[WSGetNumberAsUTF8String(), paclet:ref/c/WSGetNumberAsUTF8String])}})}})

({{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])}})}})