diff --git a/printf/include/printf_def.hpp b/printf/include/printf_def.hpp index 179dc6ff..e8b5b0c0 100644 --- a/printf/include/printf_def.hpp +++ b/printf/include/printf_def.hpp @@ -165,6 +165,16 @@ std::string vsprintf(const std::string& format, va_list va){ s += "B"; } } + // Boolean + else if(ch == 'b'){ + bool value= va_arg(va, int); + + if(value){ + s += "true"; + } else { + s += "false"; + } + } //String else if(ch == 's'){ const char* arg = va_arg(va, const char*); @@ -376,6 +386,16 @@ void vsprintf_raw(char* out_buffer, size_t /*n*/, const char* format, va_list va out_i += str_cat(out_buffer + out_i, "B"); } } + // Boolean + else if(ch == 'b'){ + bool value= va_arg(va, int); + + if(value){ + out_i += str_cat(out_buffer + out_i, "true"); + } else { + out_i += str_cat(out_buffer + out_i, "false"); + } + } //String else if(ch == 's'){ const char* arg = va_arg(va, const char*);