WSReleaseUTF8String (C 函数)

void WSReleaseUTF8String(WSLINK link,const unsigned char *s,int len)

释放由 WSGetUTF8String()分配的存储 UTF-8 编码字符串 s 的内存.

更多信息

  • WSTP 的标头文件 wstp.h 已对 WSReleaseUTF8String() 作出声明.

范例

基本范例  (1)

#include "wstp.h"

/* read a UTF-8 encoded string from a link and then release the memory to WSTP for deallocation */

void f(WSLINK lp)
{
    const unsigned char *string;
    int number_of_bytes;
    int number_of_characters

    if(! WSGetUTF8String(lp, &string, &number_of_bytes, &number_of_characters))
        { /* unable to read the UTF-8 encoded string from lp */ }

    /* ... */

    WSReleaseUTF8String(lp, string, number_of_bytes);
}