Function cJSON_CreateString

Synopsis

#include <cJSON.h>

cJSON * cJSON_CreateString(const char *string)

Description

No description yet.

Mentioned in

Source

Lines 2446-2461 in cJSON.c. Line 200 in cJSON.h.

CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
{
    cJSON *item = cJSON_New_Item(&global_hooks);
    if(item)
    {
        item->type = cJSON_String;
        item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
        if(!item->valuestring)
        {
            cJSON_Delete(item);
            return NULL;
        }
    }

    return item;
}





Add Discussion as Guest

Log in