Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > MathLink C Language Functions >
MathLink C Function

MLPutUTF8String()

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.
  • 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.
#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 */ }
}
© 2013 Wolfram Research, Inc. Japanese
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team