WSPutRealNumberAsString (C Function)

int WSPutRealNumberAsString(WSLINK l, const char *s )

sends a floating-point number encoded as ASCII string s to the WSTP connection specified by l.

Details

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

Examples

Basic Examples  (1)

#include "wstp.h"

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

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

    if(! WSPutRealNumberAsString(l, "2.75"))
    { /* 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 */ }
}