MLPutInteger16Array (C 函数)

MLPutInteger16Array 已经被 WSPutInteger16Array 所取代.

int MLPutInteger16Array(MLINK link,short *a,int *dims,char **heads,int d)

把一16位整数数组写入由 link 指定的 MathLink 连接中形成深度为 d,维数为 dims 的数组.

更多信息

  • 数组 a 在内存中的布局必须像一个被明确声明为 的 C 数组.
  • 如果 headsNULL,那么数组将被假设为在每层中具有标头 List.
  • i 层的数组长度为 .
  • MLPutInteger16Array() 在错误事件中返回0,如果函数成功则返回非零值.
  • 如果 MLPutInteger16Array() 失败,则使用 MLError() 检索错误代码.
  • MLPutInteger16Array() 在 MathLink 标头文件 mathlink.h 中被声明.

范例

基本范例  (1)

#include "mathlink.h"

/* send an array of 16-bit integers to a link */

void f(MLINK lp)
{
    short array[6][10][2][1];
    int dims[4];
    int i;

    for(i = 0; i < 120; i++)
        *((short *)array + i) = i;

    dims[0] = 6;
    dims[1] = 10;
    dims[2] = 2;
    dims[3] = 1;

    if(! MLPutInteger16Array(lp, (short *)array, (int *)dims, (char **)0, 4))
        { /* unable to put the array to lp */ }
}