WSGetReal64List (C Function)

int WSGetReal64List(WSLINK link,double **a,int *n)

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

Details

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

Examples

Basic Examples  (1)

#include "wstp.h"

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

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

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

    /* ... */

    WSReleaseReal64List(lp, list, length);
}