WSGetInteger16Array (C Function)
int WSGetInteger16Array(WSLINK link,short **a,int **dims,char ***heads,int *d)
gets an array of 16-bit integers from the WSTP connection specified by link, storing the array in a, its dimensions in dims and its depth in d.
Details
- 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.
- WSGetInteger16Array() allocates memory which must be disowned by calling WSReleaseInteger16Array(). If WSGetInteger16Array() fails the function's return value indicates an error, do not call WSReleaseInteger16Array() on the contents of a.
- External programs should not modify the arrays generated by WSGetInteger16Array().
- WSGetInteger16Array() returns immutable data.
- WSGetInteger16Array() returns 0 in the event of an error, and a nonzero value if the function succeeds.
- Use WSError() to retrieve the error code if WSGetInteger16Array() fails.
- WSGetInteger16Array() is declared in the WSTP header file wstp.h.
Examples
Basic Examples (1)
#include "wstp.h"
/* read an array of 16-bit integers from a link */
void f(WSLINK lp)
{
short *data;
int *dims;
char **heads;
int d;
if(! WSGetInteger16Array(lp, &data, &dims, &heads, &d))
{
/* unable to read the integer array */
return;
}
/* ... */
WSReleaseInteger16Array(lp, data, dims, heads, d);
}