OpenersNotesSection(Spacer1)Details

MLPutUTF8String() determines the number of characters in string s automatically.

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

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

/* send an Integrate[] expression to a link */

void f(MLINK lp)
{
	unsigned char *expr = "Integrate[1/Sin[x],x]";

	if(! MLPutFunction(lp, "EvaluatePacket", 1))
		{ /* unable to send the function to lp */ }

	if(! MLPutFunction(lp, "ToExpression", 1))
		{ /* unable to send the function to lp */ }

	if(! MLPutUTF8String(lp, (const unsigned char *)expr, 21))
		{ /* unable to send the expression to lp */ }

	if(! MLEndPacket(lp))
		{ /* unable to send the end-of-packet indicator to lp */ }

	if(! MLFlush(lp))
		{ /* unable to flush any buffered outgoing data to lp */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLPutString(), paclet:ref/c/MLPutString])  ▪  (NonWLLink[MLPutByteString(), paclet:ref/c/MLPutByteString])  ▪  (NonWLLink[MLPutUCS2String(), paclet:ref/c/MLPutUCS2String])  ▪  (NonWLLink[MLPutUTF16String(), paclet:ref/c/MLPutUTF16String])  ▪  (NonWLLink[MLPutUTF32String(), paclet:ref/c/MLPutUTF32String])}})}})

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