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