bson_string_t (3) Linux Manual Page
NAME
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
", 0, "some string", 0.123);
printf("%s
", str->str);
bson_string_free(str, true);
NOTE
- You can call
bson_string_free(3)withfalseif you would like to take ownership ofstr->str\&. Some APIs that do this might callreturn bson_string_free (str, false);after building the string.
COLOPHON
This page is part of libbson. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.
