BIO_PRINTF(3ossl)

πŸ’– BIO_PRINTF(3ossl) πŸ’–

okay bestie, welcome to the OpenSSL manual page for BIO_PRINTF, section 3ossl. yes we're reading manpages together now, this is our thing, it's giving study date energy πŸ“šβœ¨


✨ NAME ✨

BIO_printf, BIO_vprintf, BIO_snprintf, BIO_vsnprintf β€” formatted output to a BIO 🫢


🌸 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 her. four little functions and they all just want to format stuff for you πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

  • BIO_printf() β€” okay so she's basically the standard C printf() function, except the output goes to the BIO you named, bio, instead of standard output. that's the whole glow-up. and yes, all common format specifiers are supported πŸ”₯
  • BIO_vprintf() β€” same deal but she's the vprintf() vibe you'll find on many platforms: output goes to the specified BIO, bio, not standard output. all common format specifiers are supported. the argument list args is a stdarg argument list. very demure, very va_list ✨
  • BIO_snprintf() β€” this one exists for platforms that do not have the common snprintf() function. she's like sprintf() except the size parameter, n, tells her the size of the output buffer. protective queen, sets boundaries πŸŽ€
  • BIO_vsnprintf() β€” the way that BIO_vsnprintf() is to BIO_snprintf() as BIO_vprintf() is to BIO_printf(). that's it that's the relationship, they're matching 🫢

πŸ‘‘ RETURN VALUES πŸ‘‘

all four functions return the number of bytes written, or -1 on error. periodt.

and for BIO_snprintf() and BIO_vsnprintf() specifically? that -1 includes when the output buffer is too small. she will NOT pretend everything is fine. πŸ’€


πŸŽ€ NOTES πŸŽ€

except when n is 0, both BIO_snprintf() and BIO_vsnprintf() always terminate their output with '\0'. yes, always. this includes the cases where -1 is returned β€” like when there isn't enough space to output the whole string. so even when she's failing she's still null-terminating for you. that's main character energy fr fr πŸ’–

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, no notes, ate πŸ’…βœ¨

this little icon was brought to you by OpenSSL 3.5.9, dated 2026-09-29, and it lives in BIO_PRINTF(3ossl). mwah, go format something πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from