MLPutString has been replaced by WSPutString.

int MLPutString(MLINK link,const char*s)

puts a null-terminated string of C characters to the MathLink connection specified by link.


  • A raw backslash in the string must be sent as two characters ''.
  • Special characters can be sent only using the format returned by MLGetString().
  • The encoding normally used is the same as for MLGetString().
  • MLPutString() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLPutString() fails.
  • MLPutString() is declared in the MathLink header file mathlink.h.


Basic Examples  (1)

#include "mathlink.h"

/* send a string representing an expression to a Mathematica kernel
for evaluation */

void f(MLINK lp)
/* construct the packet to be sent to the kernel */
    MLPutFunction(lp, "EvaluatePacket", 1);
MLPutFunction(lp, "ToExpression", 1);
MLPutString(lp, (const char *)"3+4/Sqrt[19.2]");

/* send the packet */
    if(! MLFlush(lp))
        { /* unable to flush an outgoing data buffered in lp */ }


See Also

MLPutByteString()  MLPutUCS2String()  MLPutUTF8String()  MLPutUTF16String()  MLPutUTF32String()  MLPutSymbol()