OpenersNotesSection(Spacer1)Details

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

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

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

The array of character codes returned by MLGetByteSymbol() 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.

MLGetByteSymbol() returns immutable data.

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

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

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

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

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

	/* ... */

	MLReleaseByteSymbol(lp, symbol, length);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLReleaseByteSymbol(), paclet:ref/c/MLReleaseByteSymbol])  ▪  (NonWLLink[MLGetSymbol(), paclet:ref/c/MLGetSymbol])  ▪  (NonWLLink[MLGetUCS2Symbol(), paclet:ref/c/MLGetUCS2Symbol])  ▪  (NonWLLink[MLGetUTF8Symbol(), paclet:ref/c/MLGetUTF8Symbol])  ▪  (NonWLLink[MLGetUTF16Symbol(), paclet:ref/c/MLGetUTF16Symbol])  ▪  (NonWLLink[MLGetUTF32Symbol(), paclet:ref/c/MLGetUTF32Symbol])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(RefLinkPlain[Handling Lists, Arrays and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}})}})