mcorest_api_json_write_string_part

Write a fragment of a string value.

For an overview see page mcorest_api_json_write_*

Prototype

    MCO_RET mcorest_api_json_write_string_part( mcorest_api_json_write_ctx_t *ctx,
                                const char *s,
                                size_t len );

Arguments

ctx
Pointer to the JSON write context structure.
s
The string fragment to write.
len
The length of the string fragment; if zero, write up to the null terminator.

Description

This function writes a fragment of a string value. If len is zero, the string is written until the terminating zero is reached.

Return Codes

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

Example

    static void print_string_parts(mcorest_api_json_write_ctx_t *jctx,
                        const char *part1,
                        const char *part2)
    {
        mcorest_api_json_write_object_begin(jctx);
        mcorest_api_json_write_key(jctx, "string_parts");
        mcorest_api_json_write_string_begin(jctx);
        mcorest_api_json_write_string_part(jctx, part1, strlen(part1));
        mcorest_api_json_write_string_part(jctx, part2, strlen(part2));
        mcorest_api_json_write_string_end(jctx);
        ...
        mcorest_api_json_write_object_end(jctx);
        ...
    }

Files

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