This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
MathLink C Function


int MLPutData(MLINK link, const char *b, int count)
puts count bytes from the buffer b to the MathLink connection specified by link.
  • MLPutData() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLPutData() fails.
  • MLPutData() is declared in the MathLink header file mathlink.h.
#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(! MPutData(lp, "Hello World!", strlen("Hello World!")))
        { /* unable to put the data "Hello World!" to lp */ }