MLNewPacket (C Function)

MLNewPacket has been replaced by WSNewPacket.

int MLNewPacket(MLINK link)

skips to the end of the current packet on link.

Details

  • MLNewPacket() works even if the head of the current top-level expression is not a standard packet type.
  • MLNewPacket() does nothing if you are already at the end of a packet.
  • MLNewPacket() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLNewPacket() fails.
  • MLNewPacket() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

/* read the next number from a link and ignore everything else */

void f(MLINK lp)
{
    /* determine the type of the data on the link */
    switch(MLGetType(lp))
    {
        case MLTKINT:
            /* integer data */
            break;
        case MLTKREAL:
            /* floating point data */
            break;
        default:
            /* Skip to the next packet if not a number. */
            if(! MLNewPacket(lp))
                { /* unable to jump ahead to the next packet on lp */ }
    }
}