1BSON_STRING_T(3)                    libbson                   BSON_STRING_T(3)
2
3
4
5String Building Abstraction
6

SYNOPSIS

8          #include <bson/bson.h>
9
10          typedef struct {
11             char *str;
12             uint32_t len;
13             uint32_t alloc;
14          } bson_string_t;
15

DESCRIPTION

17       bson_string_t  is  an  abstraction  for building strings. As chunks are
18       added to the string, allocations are performed in powers of two.
19
20       This API is useful if you need to build UTF-8 encoded strings.
21

EXAMPLE

23          bson_string_t *str;
24
25          str = bson_string_new (NULL);
26          bson_string_append_printf (str, "%d %s %f\n", 0, "some string", 0.123);
27          printf ("%s\n", str->str);
28
29          bson_string_free (str, true);
30
31       TIP:
32          You can call bson_string_free() with false if you would like to take
33          ownership  of  str->str.  Some  APIs  that do this might call return
34          bson_string_free (str, false); after building the string.
35

AUTHOR

37       MongoDB, Inc
38
40       2017-present, MongoDB, Inc
41
42
43
44
451.25.1                           Nov 08, 2023                 BSON_STRING_T(3)
Impressum