int MLGetByteSymbol(MLINK link,const unsigned char **sp,int *len,long spec)
gets a character string corresponding to the name of a symbol from the MathLink connection specified by link, storing the resulting string in sp and the number of characters in len. The code spec is used for any character whose Wolfram Language character code is larger than 255.
- MLGetByteSymbol() allocates memory for the array of character codes. You must call MLReleaseByteSymbol() to disown this memory. If MLGetByteSymbol() fails the function's return value indicates an error, do not call 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 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 .
- MLGetByteSymbol() returns immutable data.
- MLGetByteSymbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
- Use MLError() to retrieve the error code if MLGetByteSymbol() fails.
- MLGetByteSymbol() is declared in the MathLink header file mathlink.h.
Basic Examples (1)
/* read a symbol encoded with codes from ToCharacterCode from a link */
void f(MLINK lp)
const unsigned char *symbol;
if(! MLGetByteSymbol(lp, &symbol, &length, 0))
/* unable to read the byte-encoded symbol from lp */
/* ... */
MLReleaseByteSymbol(lp, symbol, length);