---
name: "bstr_printf"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/bstr_printf"
---

# bstr\_printf(9)

Format a string from binary arguments and place it in a buffer

## NAME

bstr\_printf - Format a string from binary arguments and place it in a buffer

## SYNOPSIS

**int bstr\_printf(char \*** *buf***, size\_t** *size***, const char \*** *fmt***, const u32 \*** *bin\_buf***);**

## ARGUMENTS

*buf*

The buffer to place the result into

*size*

The size of the buffer, including the trailing null space

*fmt*

The format string to use

*bin\_buf*

Binary arguments for the format string

## DESCRIPTION

This function like C99 vsnprintf, but the difference is that vsnprintf gets arguments from stack, and bstr\_printf gets arguments from *bin\_buf* which is a binary buffer that generated by vbin\_printf.

The format follows C99 vsnprintf, but has some extensions: see vsnprintf comment for details.

The return value is the number of characters which would be generated for the given input, excluding the trailing '\\0', as per ISO C99. If you want to have the exact number of characters written into *buf* as return value (not including the trailing '\\0'), use **vscnprintf**. If the return is greater than or equal to *size*, the resulting string is truncated.

## COPYRIGHT
