WSTestString()
This feature is not supported on the Wolfram Cloud.

int WSTestString(WSLINK l, const char *s)
tests that the next expression to be read from l is a string with the value s.

DetailsDetails

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

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

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

void f(WSINK l)
{
    if(! WSTestString(l, "$Version"))
    { /* The next expression on the link is not $Version */ }
    else
    { /* The next expression on the link is $Version */ }
}
Introduced in 2014
(10.0)