MLEndPacket (C Function)

MLEndPacket has been replaced by WSEndPacket.

int MLEndPacket(MLINK link)

inserts an indicator in the expression stream that says the current expression is complete and is ready to be sent.

Details

  • MLEndPacket() should be called to indicate the end of any top-level expression, regardless of whether its head is a standard packet.
  • MLEndPacket() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLEndPacket() fails.
  • MLEndPacket() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

/* send the expression {10, Times[3.56, 10], 1.3} to a link */

void f(MLINK lp)
{
    if(! MLPutFunction(lp, "List", 3))
        { /* unable to send the function List to lp */ }

    if(! MLPutInteger32(lp, 10))
        { /* unable to send the integer 10 to lp */ }

    if(! MLPutFunction(lp, Times, 2))
        { /* unable to send the function Times to lp */ }

    if(! MLPutReal64(lp, 3.56))
        { /* unable to send the double 3.56 to lp */ }

    if(! MLPutInteger32(lp, 10))
        { /* unable to send the integer 10 to lp */ }

    if(! MLPutReal32(lp, 1.3))
        { /* unable to send the float 1.3 to lp */ }

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