MLPutUTF16Function (C 函数)

MLPutUTF16Function 已经被 WSPutUTF16Function 所取代.

int WLPutUTF16Function(( MLINK l , const unsigned short * s , int v , int n )

puts a function with head given by a UTF-16 encoded symbol with name s of length v and with n arguments to the MathLink connection specified by l.

更多信息

  • After the call to WLPutUTF16Function(), other MathLink functions must be called to send the arguments of the function.
  • The function name s encoded in UTF-16 must start with a byte order mark.
  • The length of the symbol name s must include the byte order mark.
  • MLPutUTF16Function() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLPutUTF16Function() fails.
  • MLPutUTF16Function() is declared in the MathLink header file mathlink.h.

范例

基本范例  (1)

#include "mathlink.h"

/* A function to send List[1,2,3] to the link */

void f(MLINK l)
{
    unsigned short name[5];

    name[0] = 0xFEFF;
    name[1] = 'L';
    name[2] = 'i';
    name[3] = 's';
    name[4] = 't';

    if(! MLPutUTF16Function(l, (unsigned short *)name, 5, 3))
    { /* Unable to write the function head to the link */ }

    if(! MLPutInteger8(l, 1))
    { /* Unable to write 1 to the link */ }

    if(! MLPutInteger8(l, 2))
    { /* Unable to write 2 to the link */ }

    if(! MLPutInteger8(l, 3))
    { /* Unable to write 3 to the link */ }

    if(! MLEndPacket(l))
    { /* Unable to write the end-of-packet sequence to the link */ }

    if(! MLFlush(l))
    { /* Unable to flush any outbound data from the link */ }
}