WSPutData (C Function)

int WSPutData(WSLINK link,const char *b,int count)

puts count bytes from the buffer b to the WSTP connection specified by link.


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


Basic Examples  (1)

#include <string.h>
#include "wstp.h"

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

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

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

    if(! WSPutData(lp, "Hello World!", strlen("Hello World!")))
        { /* unable to put the data "Hello World!" to lp */ }