mcorest_api_json_write_string

Write a string.

For an overview see page mcorest_api_json_write_*

Prototype

 
    MCO_RET mcorest_api_json_write_string( mcorest_api_json_write_ctx_t *ctx, const char *str );
     

Arguments

ctx Pointer to the JSON write context structure
str Character string to write

Description

This function writes a string. It escapes double quotes and backslashes. If the string is NULL, writes null. This is a convenience wrapper for mcorest_api_json_write_string_begin(), mcorest_api_json_write_string_part() and mcorest_api_json_write_string_end().

Return Codes

MCO_S_OK = 0 Success
MCO_E_REST_* Any of the Web Services Error Codes

Example

 
    static void print_string(mcorest_api_json_write_ctx_t *jctx,
                        const char *s)
    {
        mcorest_api_json_write_object_begin(jctx);
        mcorest_api_json_write_key(jctx, "string_value");
        mcorest_api_json_write_string(jctx, s);
        ...
        mcorest_api_json_write_object_end(jctx);
        ...
    }
     

Files

Header file:
mcorestapi.h
Source file:
jsonwr.c
Library:
libmcorest.a