WSUCS2LinkName (C Function)

const unsigned short * WSUCS2LinkName(WSLINK l, int *n)

returns the name of the link encoded as an UCS2 encoded string of length n from the WSTP connection specified by l.

Details

  • WSUCS2LinkName() allocates memory for the link name that must be released. To release the memory, call WSReleaseUCS2LinkName() on the value returned by the function. If WSUCS2LinkName() returns NULL, do not call WSReleaseUCS2LinkName() on the NULL value.
  • Programs should not modify the contents of the string returned by WSUCS2LinkName().
  • WSTP links are created using a combination of link mode, link protocol, and other options. The link name provides necessary information for the link mode and the link protocol used to create the link.
  • WSUCS2LinkName() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* A function for reading a link's name */

void f(WSLINK l)
{
    const unsigned short *name;
    int length;

    name = WSUCS2LinkName(l, &length);
    if(name == NULL || length == 0)
    { /* Unable to read link name */ }

    /* ... */

    WSReleaseUCS2LinkName(l, name, length);
}