MLTestString (C Function)

MLTestString has been replaced by WSTestString.

int MLTestString(MLINK l, const char *s)

tests that the next expression to be read from l is a string with the value s.

Details

  • MLTestString() fails if the current object on the link is not a string, or if the value of the string does not match s.
  • MLTestString() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLTestString() fails.
  • MLTestString() will reset the stream pointer to the expression on the link just prior to calling MLTestString()if the function fails. This operation behaves as if the programmer called MLCreateMark(link); MLTestString(); MLSeekToMark().
  • MLTestString() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

/* A function for testing the next expression on the link for a string */

void f(MLINK l)
{
    if(! MLTestString(l, "$Version"))
    { /* The next expression on the link is not $Version */ }
    else
    { /* The next expression on the link is $Version */ }
}