bson_string_t man page

bson_string_t — bson_string_t

String Building Abstraction

Synopsis

#include <bson.h>

typedef struct {
   char *str;
   uint32_t len;
   uint32_t alloc;
} bson_string_t;

Description

bson_string_t is an abstraction for building strings. As chunks are added to the string, allocations are performed in powers of two.

This API is useful if you need to build UTF-8 encoded strings.

Example

bson_string_t *str;

str = bson_string_new (NULL);
bson_string_append_printf (str, "%d %s %f\n", 0, "some string", 0.123);
printf ("%s\n", str->str);

bson_string_free (str, true);

Author

MongoDB, Inc

Info

Mar 07, 2017 1.6.1 Libbson