WSTestString (C Function)
int WSTestString(WSLINK l, const char *s)
tests that the next expression to be read from l is a string with the value s.
Details
- 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.
Examples
Basic Examples (1)
#include "wstp.h"
/* A function for testing the next expression on the link for a string */
void f(WSLINK l)
{
if(! WSTestString(l, "$Version"))
{ /* The next expression on the link is not $Version */ }
else
{ /* The next expression on the link is $Version */ }
}