WSPutUTF8String (C Function)
int WSPutUTF8String(WSLINK link,const unsigned char *s,int len)
puts a UTF-8 string s of len bytes to the WSTP connection specified by link.
Details
- WSPutUTF8String() determines the number of characters in string s automatically.
- WSPutUTF8String() returns 0 in the event of an error, and a nonzero value if the function succeeds.
- Use WSError() to retrieve the error code if WSPutUTF8String() fails.
- WSPutUTF8String() is declared in the WSTP header file wstp.h.
Examples
Basic Examples (1)
#include "wstp.h"
/* send an Integrate[] expression to a link */
void f(WSLINK lp)
{
unsigned char *expr = "Integrate[1/Sin[x],x]";
if(! WSPutFunction(lp, "EvaluatePacket", 1))
{ /* unable to send the function to lp */ }
if(! WSPutFunction(lp, "ToExpression", 1))
{ /* unable to send the function to lp */ }
if(! WSPutUTF8String(lp, (const unsigned char *)expr, 21))
{ /* unable to send the expression to lp */ }
if(! WSEndPacket(lp))
{ /* unable to send the end-of-packet indicator to lp */ }
if(! WSFlush(lp))
{ /* unable to flush any buffered outgoing data to lp */ }
}