1BSON_UINT32_TO_STRING(3) libbson BSON_UINT32_TO_STRING(3)
2
3
4
6 bson_uint32_to_string - bson_uint32_to_string()
7
9 size_t
10 bson_uint32_to_string (uint32_t value,
11 const char **strptr,
12 char *str,
13 size_t size);
14
16 • value: A uint32_t.
17
18 • strptr: A location for the resulting string pointer.
19
20 • str: A location to buffer the string.
21
22 • size: A size_t containing the size of str.
23
25 Converts value to a string.
26
27 If value is from 0 to 999, it will use a constant string in the data
28 section of the library.
29
30 If not, a string will be formatted using str and snprintf().
31
32 strptr will always be set. It will either point to str or a constant
33 string. Use this as your key.
34
36 Each element in a BSON array has a monotonic string key like "0", "1",
37 etc. This function is optimized for generating such string keys.
38
39 char str[16];
40 const char *key;
41 uint32_t i;
42
43 for (i = 0; i < 10; i++) {
44 bson_uint32_to_string (i, &key, str, sizeof str);
45 printf ("Key: %s\n", key);
46 }
47
49 The number of bytes in the resulting string.
50
52 MongoDB, Inc
53
55 2017-present, MongoDB, Inc
56
57
58
59
601.21.1 Mar 02, 2022 BSON_UINT32_TO_STRING(3)