Function yaml_emitter_set_output_string

Synopsis

#include <include/yaml.h>

void yaml_emitter_set_output_string(yaml_emitter_t *emitter, unsigned char *output, size_t size, size_t *size_written)

Description

Set a string output.

The emitter will write the output characters to the output buffer of the size size. The emitter will set size_written to the number of written bytes. If the buffer is smaller than required, the emitter produces the YAML_WRITE_ERROR error.

Parameters:

[ in,out ] emitter - An emitter object.

[ in ] output - An output buffer.

[ in ] size - The buffer size.

[ in ] size_written - The pointer to save the number of written bytes.

Set a string output.

Source

Lines 456-471 in src/api.c. Line 1817 in include/yaml.h.

YAML_DECLARE(void)
yaml_emitter_set_output_string(yaml_emitter_t *emitter,
        unsigned char *output, size_t size, size_t *size_written)
{
    assert(emitter);    /* Non-NULL emitter object expected. */
    assert(!emitter->write_handler);    /* You can set the output only once. */
    assert(output);     /* Non-NULL output string expected. */

    emitter->write_handler = yaml_string_write_handler;
    emitter->write_handler_data = emitter;

    emitter->output.string.buffer = output;
    emitter->output.string.size = size;
    emitter->output.string.size_written = size_written;
    *size_written = 0;
}





Add Discussion as Guest

Log in to DocsForge