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