BIO_PRINTF(3ossl)
π NAME π
BIO_printf, BIO_vprintf, BIO_snprintf, BIO_vsnprintf β formatted output to a BIO. This is the 3ossl manual page, bestie, and it is literally the βprintf but make it BIOβ situation β¨
πΈ SYNOPSIS πΈ
#include <openssl/bio.h>
int BIO_printf(BIO *bio, const char *format, ...);
int BIO_vprintf(BIO *bio, const char *format, va_list args);
int BIO_snprintf(char *buf, size_t n, const char *format, ...);
int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
π¦ DESCRIPTION π¦
BIO_printf() is giving standard C printf() energy, except the output goes to the specified BIO, bio, instead of standard output. All common format specifiers are supported β slay π
BIO_vprintf() is like the vprintf() function found on many platforms, and the output is sent to the specified BIO, bio, rather than standard output. All common format specifiers are supported. The argument list args is a stdarg argument list. Iconic, honestly π«Ά
BIO_snprintf() is for platforms that do not have the common snprintf() function. It is like sprintf() except that the size parameter, n, specifies the size of the output buffer. Main character energy for sure β¨
BIO_vsnprintf() is to BIO_snprintf() as BIO_vprintf() is to BIO_printf(). That is the whole relationship, no cap π
π RETURN VALUES π
All functions return the number of bytes written, or -1 on error. For BIO_snprintf() and BIO_vsnprintf(), this includes when the output buffer is too small. Yes bestie, the too-small-buffer moment still gets you that -1 π
π NOTES π
Tiny but important caveat, fr fr: except whennis0, bothBIO_snprintf()andBIO_vsnprintf()always terminate their output with'\0'.
This includes cases where -1 is returned, such as when there is insufficient space to output the whole string. So even in the messy -1 era, the '\0' still shows up unless n is 0. Periodt πβ¨
π COPYRIGHT π
Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the βLicenseβ). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
xoxo, the 3ossl manual π β version 3.5.6, dated 2026-04-07 π
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms