WSPutRealNumberAsUTF32String (C Function)

int WSPutRealNumberAsUTF32String(WSLINK l, const unsigned int *s, int n)

sends the floating-point number encoded as UTF-32 string s of length n to the WSTP connection specified by l.


  • Send the number s in the form "3.14159"
  • The number s encoded in UTF-32 must begin with a byte order mark.
  • The length of the number n must include the byte order mark.
  • WSPutRealNumberAsUTF32String() returns 0 on error, and a nonzero value if the function succeeds.
  • WSPutRealNumberAsUTF32String() is declared in the WSTP header file wstp.h.


Basic Examples  (1)

#include "wstp.h"

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

void f(WSLINK l)
    unsigned int theNumber[5];

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

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

    if(! WSPutRealNumberAsUTF32String(l, theNumber, 5))
    { /* 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 */ }