BSON_STRNCPY(3)
π BSON_STRNCPY(3) π
okay so bestie, welcome to BSON_STRNCPY(3) β it's a libbson page and it's literally about copying strings safely. no cap, this one's a little icon. β¨
β¨ SYNOPSIS β¨
void
bson_strncpy (char *dst, const char *src, size_t size);
π PARAMETERS π
dstβ the destination buffer. the place stuff gets copied into, the main character of the operation πsrcβ the src buffer. the source, the origin story, the vibe provider πΈsizeβ the number of bytes to copy intodst, which must be at least that size. sodsthas to actually be big enough, no squeezing, we don't do that here π«Ά
π¦ DESCRIPTION π¦
So what it does: it copies up to size bytes from src into dst. simple. and dst must be at least size bytes in size β that's not a suggestion, that's the whole deal. after all that copying, a trailing \0 is always set. always always. π
it does nothing if size is zero. like, zero work, zero drama, zero bytes. π
here's the tea though: bson_strncpy matches the behavior of the C11 standard strncpy_s, rather than strncpy. lowkey important distinction!! this means bson_strncpy always writes a null terminator to dst, even if dst is too short to fit the entire string from src. it's showing up and doing the job no matter what π
and if there's additional space left in dst after copying src, bson_strncpy does not fill the remaining space with null characters. nope! it just leaves it. no padding, no filler, no extra nulls. periodt. π
bestie don't confuse it with plain strncpy β the whole point is that it always null-terminates, so π keep π that π in π mind π
π AUTHOR π
MongoDB, Inc β the legends themselves π«Ά
π COPYRIGHT π
2009-present, MongoDB, Inc. β iconic, copyrighted, and thriving since 2009 β
and that's the whole page, bestie!! π¦ you're now a bson_strncpy girly fr fr π this was libbson 2.5.6, dated Oct 09, 2026 β catch you on the next manpage, mwah ππ
π¦ where this page comes from
- epel 10: libbson-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms