WSTestUTF8Symbol (C Function)
int WSTestUTF8Symbol(WSLINK l, const unsigned char *s, int n)
tests that the next expression on the WSTP connection specified by l is a symbol with the value s, a UTF-8 encoded string of length n.
Details
- WSTestUTF8Symbol() fails if the current expression on the link l is not a symbol, or if the value of the symbol does not match s.
- WSTestUTF8Symbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
- Use WSError() to retrieve the error code if WSTestUTF8Symbol() fails.
- WSTestUTF8Symbol() will reset the stream pointer to the expression on the link just prior to calling WSTestUTF8Symbol()if the function fails. This operation behaves as if the programmer called WSCreateMark(link); WSTestUTF8Symbol(…); WSSeekToMark(…).
- WSTestUTF8Symbol() is declared in the WSTP header file wstp.h.
Examples
Basic Examples (1)
#include "wstp.h"
/* A function for testing the next symbol on the link */
void f(WSLINK l)
{
const unsigned char theSymbol[5];
theSymbol[0] = 'L';
theSymbol[1] = 'i';
theSymbol[2] = 's';
theSymbol[3] = 't';
if(! WSTestUTF8Symbol(l, (const unsigned char *)theSymbol,
4))
{ /* The next expression on the link is not List */ }
else
{ /* The next expression on the link is List */ }
}