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

int WSGetIntegerList(WSLINK link,int **a,long *n)
gets a list of integers from the WSTP connection specified by link, storing the integers in the array a and the length of the list in n.

DetailsDetails

  • WSGetIntegerList() allocates memory for the array of integers. You must call WSDisownIntegerList() to disown this memory. If WSGetIntegerList() fails and the function's return value indicates an error, do not call WSDisownIntegerList() on the contents of a.
  • WSGetIntegerList() returns immutable data.
  • WSGetIntegerList() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSGetIntegerList() fails.
  • WSGetIntegerList() is declared in the WSTP header file wstp.h.
  • WSGetIntegerList() is equivalent to WSGetInteger32List().

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* read a list of integers from a link */

void f(MLINK lp)
{
    int *data;
    long length;

    if(! WSGetIntegerList(lp, &data, &length))
        {
            /* unable to read the integer list from lp */
            return;
        }

    /* ... */

    WSDisownIntegerList(lp, data, length);
}