MLGetIntegerList (C Function)

MLGetIntegerList has been replaced by WSGetIntegerList.

int MLGetIntegerList(MLINK link,int **a,long *n)

gets a list of integers from the MathLink connection specified by link, storing the integers in the array a and the length of the list in n.

Details

  • MLGetIntegerList() allocates memory for the array of integers. You must call MLDisownIntegerList() to disown this memory. If MLGetIntegerList() fails and the function's return value indicates an error, do not call MLDisownIntegerList() on the contents of a.
  • MLGetIntegerList() returns immutable data.
  • MLGetIntegerList() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetIntegerList() fails.
  • MLGetIntegerList() is declared in the MathLink header file mathlink.h.
  • MLGetIntegerList() is equivalent to MLGetInteger32List().

Examples

Basic Examples  (1)

#include "mathlink.h"

/* read a list of integers from a link */

void f(MLINK lp)
{
    int *data;
    long length;

    if(! MLGetIntegerList(lp, &data, &length))
        {
            /* unable to read the integer list from lp */
            return;
        }

    /* ... */

    MLDisownIntegerList(lp, data, length);
}