MLPutUTF8String (C Function)

MLPutUTF8String has been replaced by WSPutUTF8String.

int MLPutUTF8String(MLINK link,const unsigned char *s,int len)

puts a UTF-8 string s of len bytes to the MathLink connection specified by link.

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 MLError() to retrieve the error code if MLPutUTF8String() fails.
  • MLPutUTF8String() is declared in the MathLink header file mathlink.h.

Examples

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 */ }
}