WSGetIntegerArray()
This feature is not supported on the Wolfram Cloud.

int WSGetIntegerArray(WSLINK link,int **a,long **dims,char ***heads,long *d)
gets an array of integers from the WSTP connection specified by link, storing the array in a, its dimensions in dims and its depth in d.

DetailsDetails

  • The array a is laid out in memory like a C array declared as .
  • heads gives a list of character strings corresponding to the names of symbols that appear as heads at each level in the array.
  • WSGetIntegerArray() allocates memory which must be disowned by calling WSDisownIntegerArray(). If WSGetIntegerArray() fails and the function's return value indicates an error, do not call WSDisownIntegerArray()on the contents of a.
  • External programs should not modify the arrays generated by WSGetIntegerArray().
  • WSGetIntegerArray() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSGetIntegerArray() fails.
  • WSGetIntegerArray() is equivalent to WSGetInteger32Array().

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* read an array of integers from a link */

void f(MLINK lp)
{
    int *data;
    long *dims;
    char **heads;
    long d;

    if(! WSGetIntegerArray(lp, &data, &dims, &heads, &d))
        {
            /* unable to read the integer array */
            return;
        }

    /* ... */

    WSDisownIntegerArray(lp, data, dims, heads, d);
}