MLReady()

int MLReady(MLINK link)
tests whether there is data ready to be read from link.

DetailsDetails

  • Analogous to the Mathematica function LinkReadyQ.
  • MLReady() is often called in a loop as a way of polling a MathLink connection.
  • MLReady() will always return immediately, and will not block.
  • You must call MLFlush() before calling MLReady().
  • MLReady() returns 0 if the link has no data to read and a nonzero value if the link does have data.
  • MLReady() is declared in the MathLink header file mathlink.h.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

#include "mathlink.h"

/* check a link for readable data */

void f(MLINK lp);
{
    if(! MLFlush(lp))
        { /* unable to flush any outgoing data buffered in lp */ }

    if(MLReady(lp))
        { /* read the data from the link */ }
    else
        { /* data not ready to read */ }
}
New to Mathematica? Find your learning path »
Have a question? Ask support »