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

int WSGetString(WSLINK link,const char **s)
gets a character string from the WSTP connection specified by link, storing the string in s.

DetailsDetails

  • WSGetString() allocates memory for the character string. You must call WSReleaseString() to disown this memory. If WSGetString() fails and the function's return value indicates an error, do not call WSReleaseString() on the contents of s.
  • WSGetString() returns immutable data.
  • WSGetString() creates a string that is terminated by 0.
  • WSGetString() stores single characters from the Wolfram Language as pairs of characters .
  • WSGetString() stores special characters from the Wolfram Language in a private format.
  • WSGetString() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSGetString() fails.
  • WSGetString() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* read a string from a link */

void f(MLINK lp)
{
    const char *string;

    if(! WSGetString(lp, &string))
        {
            /* unable to read the string from lp */
            return;
        }

    /* ... */

    WSReleaseString(lp, string);
}