---
name: "bson_snprintf"
section: "3"
platform: "linux"
package: "libbson-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/bson_snprintf"
---

# bson\_snprintf(3)

## SYNOPSIS

```
int
bson_snprintf (char *str, size_t size, const char *format, ...);
```

## PARAMETERS

- •

  **str**: The destination buffer.

- •

  **size**: The size of **str**.

- •

  **format**: A printf style format string.

## DESCRIPTION

This is a portable wrapper around **snprintf()**. It also enforces a trailing **\\0** in the resulting string.

## RETURNS

The number of bytes written to **str**.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
