WSGetInteger16List (C Function)

int WSGetInteger16List(WSLINK link,short **a,int *n)

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


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


Basic Examples  (1)

#include "wstp.h"

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

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

    if(! WSGetInteger16List(lp, &data, &length))
            /* unable to read the integer list from lp */

    /* ... */

    WSReleaseInteger16List(lp, data, length);