WSPutSize (C Function)

int WSPutSize(WSLINK link,int len)

specifies the length in bytes of the textual data to be put on link.

Details

  • WSPutSize() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSPutSize() fails.
  • WSPutSize() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* send the string "Hello World!" to a link */

void f(WSLINK lp)
{
    if(! WSPutNext(lp, WSTKSTR))
        { /* unable to put the data type to lp */ }

    if(! WSPutSize(lp, strlen("Hello World!"))
        { /* unable to put the string size to lp */ }

    if(! MPutData(lp, "Hello World!", strlen("Hello World!")))
        { /* Unable to put the string contents to lp */ }
}