MLReady (C Function)

MLReady has been replaced by WSReady.

int MLReady(MLINK link)

tests whether there is data ready to be read from link.

Details

  • Analogous to the Wolfram Language 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.

Examples

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 */ }
}