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.

ExamplesExamplesopen allclose all

Basic Examples (1)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(! MPutData(lp, "Hello World!", strlen("Hello World!")))
        { /* unable to put the data "Hello World!" to lp */ }
New to Mathematica? Find your learning path »
Have a question? Ask support »