OpenersNotesSection(Spacer1)Details

WSGetByteSymbol() allocates memory for the array of character codes. You must call (NonWLLink[WSReleaseByteSymbol(), paclet:ref/c/WSReleaseByteSymbol]) to disown this memory. If WSGetByteSymbol() fails the function's return value indicates an error, do not call (NonWLLink[WSReleaseByteSymbol(), paclet:ref/c/WSReleaseByteSymbol]) on the value contained in sp.

WSGetByteSymbol() is convenient in situations where no special characters occur.

The character codes used by WSGetByteSymbol() are exactly the ones returned by (RefLink[ToCharacterCode, paclet:ref/ToCharacterCode]) in the Wolfram Language.

The array of character codes returned by WSGetByteSymbol() is not terminated by a null character.

Characters such as newlines are specified by their raw character codes, not by ASCII forms such as ∖n.

WSGetByteSymbol() returns immutable data.

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

WSGetByteSymbol() 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"

/* read a symbol encoded with codes from ToCharacterCode[] from a link */

void f(WSLINK lp)
{
	const unsigned char *symbol;
	int length;

	if(! WSGetByteSymbol(lp, &symbol, &length, 0))
		{
			/* unable to read the byte-encoded symbol from lp */
			return;
		}

	/* ... */

	WSReleaseByteSymbol(lp, symbol, length);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSReleaseByteSymbol(), paclet:ref/c/WSReleaseByteSymbol])  ▪  (NonWLLink[WSGetSymbol(), paclet:ref/c/WSGetSymbol])  ▪  (NonWLLink[WSGetUCS2Symbol(), paclet:ref/c/WSGetUCS2Symbol])  ▪  (NonWLLink[WSGetUTF8Symbol(), paclet:ref/c/WSGetUTF8Symbol])  ▪  (NonWLLink[WSGetUTF16Symbol(), paclet:ref/c/WSGetUTF16Symbol])  ▪  (NonWLLink[WSGetUTF32Symbol(), paclet:ref/c/WSGetUTF32Symbol])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(RefLinkPlain[Handling Lists, Arrays and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}, {▪(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 Symbols, paclet:guide/WSTPCFunctionsForExchangingSymbols])}})}})