WSNewPacket (C Function)

int WSNewPacket(WSLINK link)

skips to the end of the current packet on link.


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


Basic Examples  (1)

#include "wstp.h"

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

void f(WSLINK lp)
    /* determine the type of the data on the link */
        case WSTKINT:
            /* integer data */
        case WSTKREAL:
            /* floating point data */
            /* Skip to the next packet if not a number. */
            if(! WSNewPacket(lp))
                { /* unable to jump ahead to the next packet on lp */ }