Mathematica > Systems Interfaces & Deployment > C/C++ Language Interface > MathLink C Language Functions >
Mathematica > Systems Interfaces & Deployment > MathLink API > MathLink C Language Functions >
MathLink C Function

MLSeekToMark()

MLMARK MLSeekToMark(MLINK link, MLMARK mark, int n)
goes to the position n expressions after the specified mark on a link.
  • MLSeekToMark() returns (MLMARK)0 in the event of an error and mark otherwise.
  • MLSeekToMark() is declared in the MathLink header file mathlink.h.
#include "mathlink.h"

/* look ahead in the expression stream on a link and reset */

void f(MLINK lp)
{
    MLMARK mark;
    
    mark = MLCreateMark(lp);
    if(mark == (MLMARK)0)
        { /* unable to create mark in the stream on lp */ }

    /* now peek ahead and see what is coming */
    switch(MLGetNext(lp))
    {
        case MLTKINT:
            /* integer data */
        case MLTKREAL:
            /* floating-point data */
    }

    /* now restore to the original point */
    mark = MLSeekToMark(lp, mark, 0);
    if(mark == (MLMARK)0)
        { /* unable to seek to the mark position in lp */ }

    MLDestroyMark(lp, mark);
}
© 2008 Wolfram Research, Inc.
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team