WSGetReal128List (C Function)

int WSGetReal128List(WSLINK link,wsextended_double **a,int *n)

gets a list of extended-precision floating-point numbers from the WSTP connection specified by link, storing the numbers in the array a and the length of the list in n.

Details

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

Examples

Basic Examples  (1)

#include "wstp.h"

/* read a list of extended-precision floating-point numbers from a link */

void f(WSLINK lp)
{
    wsextended_double *list;
    int length;

    if(! WSGetReal128List(lp, &list, &length))
        {
            /* unable to read the list of numbers from lp */
            return;
        }

    /* ... */

    WSReleaseReal128List(lp, list, length);
}