1BSON_STRNCPY(3) libbson BSON_STRNCPY(3)
2
3
4
6 void
7 bson_strncpy (char *dst, const char *src, size_t size);
8
10 • dst: The destination buffer.
11
12 • src: The src buffer.
13
14 • size: The number of bytes to copy into dst, which must be at least
15 that size.
16
18 Copies up to size bytes from src into dst. dst must be at least size
19 bytes in size. A trailing \0 is always set.
20
21 Does nothing if size is zero.
22
23 bson_strncpy matches the behavior of the C11 standard strncpy_s, rather
24 than strncpy. This means that bson_strncpy always writes a null termi‐
25 nator to dst, even if dst is too short to fit the entire string from
26 src. If there is additional space left in dst after copying src,
27 bson_strncpy does not fill the remaining space with null characters.
28
30 MongoDB, Inc
31
33 2017-present, MongoDB, Inc
34
35
36
37
381.25.1 Nov 08, 2023 BSON_STRNCPY(3)