BIO_PRINTF(3SSL)
β¨ BIO_PRINTF(3SSL) β¨
okay bestie, welcome to the OpenSSL manual page for BIO_printf and its little squad π we're doing formatted output, but make it BIO. stay with me, this one's short and honestly kinda iconic.
πΈ NAME πΈ
BIO_printf, BIO_vprintf, BIO_snprintf, BIO_vsnprintf β formatted output to a BIO. yes. all four. they're a package deal π«Ά
π 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);
like, look at them. so clean. so demure π
π¦ DESCRIPTION π¦
so BIO_printf() is giving regular C printf() energy, except the output doesn't go to standard output β it goes to the BIO you hand it, aka bio. and yes bestie, all the common format specifiers are supported β¨
then there's BIO_vprintf(), which is the vprintf()-coded cousin you'll find on lots of platforms. same deal: the output goes to the BIO you named, bio, not standard output. all common format specifiers work here too. the args argument is a stdarg argument list, so it's the one you'd reach for when you're passing varargs along π
BIO_snprintf() exists for the platforms that are out here not having the common snprintf() function π it's like sprintf(), except the size parameter n tells it how big the output buffer is. protect the buffer. periodt.
and BIO_vsnprintf() is to BIO_snprintf() what BIO_vprintf() is to BIO_printf(). matching set fr fr π
β RETURN VALUES β
all of these functions return the number of bytes written, or -1 on error. and for BIO_snprintf() and BIO_vsnprintf() specifically, that -1 situation includes when the output buffer is too small π like, not enough room = error, bestie.
π NOTES π
here's the detail that matters, no cap:
unless n is 0, both BIO_snprintf() and BIO_vsnprintf() always terminate their output with '\0'. yes, even in the cases where -1 is returned β including when there's not enough space to output the whole string. so the null's still showing up to the party even when the string couldn't fit π
π 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>.
and that's the whole page, bestie π«Ά this was OpenSSL BIO_PRINTF(3SSL), version 4.0.3, dated 2026-09-29 β go format something cute, and remember to size your buffers πβ¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms