WSGetInteger32List (C Function)

int WSGetInteger32List(WSLINK link,int **a,int *n)

gets a list of 32-bit integers from the WSTP connection specified by link, storing the integers in the array a and the length of the list in n.

Details

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

Examples

Basic Examples  (1)

#include "wstp.h"

/* read a list of 32-bit integers from a link */

void f(WSLINK lp)
{
    int *data;
    int length;

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

    /* ... */

    WSReleaseInteger32List(lp, data, length);
}