WSGetRealList (C Function)

int WSGetRealList(WSLINK link,double **a,long *n)

gets a list of 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

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

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;
    long length;

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

    /* ... */

    WSDisownRealList(lp, list, length);
}