OpenersNotesSection(Spacer1)Details

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

MLPutData() 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 <string.h>
#include "mathlink.h"

/*  send "Hello World!" to a link */

void f(MLINK lp)
{
	if(! MLPutNext(lp, MLTKSTR))
		{ /* unable to put type MLTKSTR to lp */ }

	if(! MLPutSize(lp, strlen("Hello World!"))
		{ /* unable to put the length of "Hello World!" to lp */ }

	if(! MLPutData(lp, "Hello World!", strlen("Hello World!")))
		{ /* unable to put the data "Hello World!" to lp */ }
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLPutType(), paclet:ref/c/MLPutType])  ▪  (NonWLLink[MLPutArgCount(), paclet:ref/c/MLPutArgCount])  ▪  (NonWLLink[MLPutSize(), paclet:ref/c/MLPutSize])}})}})