WSGetInteger8List (C Function)

int WSGetInteger8List( WSLINK l , unsigned char ** i , int * c )

gets a list of 8-bit integers from the WSTP connection specified by l, storing the integers in the array i and the length of the list in c.

Details

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

Examples

Basic Examples  (1)

#include "wstp.h"

/* A function for reading a list of 8-bit integers from a link */

void f(WSLINK l)
{
    unsigned char *data;
    int length;
    
    if(! WSGetInteger8List(l, &data, &length))
    { /* Unable to read the integer list from the link */ }

    /* ... */

    WSReleaseInteger8List(l, data, length);
}