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

int WSPutRealNumberAsUTF8String(WSLINK l, const unsigned char *s, int n)
sends a floating-point number encoded as UTF-8 string s of length n to the WSTP connection specified by l.

DetailsDetails

  • Send the number s in the form "3.14159".
  • WSPutRealNumberAsUTF8String() returns 0 on error, and a nonzero value if the function succeeds.
  • WSPutRealNumberAsUTF8String() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* A function to put the expression Sqrt[2.75] to a link */

void f(WSINK l)
{
    unsigned char *theNumber[4];

    theNumber[0] = '2';
    theNumber[1] = '.';
    theNumber[2] = '7';
    theNumber[3] = '5';

    if(! WSPutFunction(l, "Sqrt", 1))
    { /* Unable to put Sqrt[] to the link */ }

    if(! WSPutRealNumberAsUTF8String(l, theNumber, 4))
    { /* Unable to put the number to the link */}

    if(! WSEndPacket(l))
    { /* Unable to put the end-of-packet sequence to l */ }

    if(! WSFlush(l))
    { /* Unable to flush any output buffered in l */ }
}