MLFlush (C Function)

MLFlush has been replaced by WSFlush.

int MLFlush(MLINK link)

flushes out any buffers containing data waiting to be sent on link.

Details

  • If you call MLNextPacket() or any of the MLGet functions, then MLFlush() will be called automatically.
  • If you call MLReady(), then you need to call MLFlush() first in order to ensure that any necessary outgoing data has been sent.
  • MLFlush() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLFlush() fails.
  • MLFlush() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

/* send the expression Integrate[1/x^2,x] to a link */

void f(MLINK lp)
{
    if(! MLPutFunction(lp, "EvaluatePacket", 1))
        { /* unable to put the function to lp */ }

    if(! MLPutFunction(lp, "ToExpression", 1))
        { /* unable to put the function to lp */ }

    if(! MLPutString(lp, "Integrate[1/x^2, x]"))
        { /* unable to put the string to lp */ }

    if(! MLEndPacket(lp))
        { /* unable to put the end of packet indicator to lp */ }

    if(! MLFlush(lp))
        { /* unable to flush the buffered data in lp */ }
}