From dd6ebdeb4f8c4bed27aa52ad37e7582ba8b7bd65 Mon Sep 17 00:00:00 2001 From: Koncord Date: Thu, 18 Aug 2016 08:44:47 +0800 Subject: [PATCH] formated C string to C++ --- components/openmw-mp/Log.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/openmw-mp/Log.cpp b/components/openmw-mp/Log.cpp index 6275b8864..8192da201 100644 --- a/components/openmw-mp/Log.cpp +++ b/components/openmw-mp/Log.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "Log.hpp" using namespace std; @@ -89,6 +90,10 @@ void Log::print(int level, const char *file, int line, const char *message, ...) sstr << '\n'; va_list args; va_start(args, message); - vprintf(sstr.str().c_str(), args); + vector buf(vsnprintf(NULL, 0, sstr.str().c_str(), args) + 1); va_end(args); + va_start(args, message); + vsnprintf(buf.data(), buf.size(), sstr.str().c_str(), args); + va_end(args); + cout << buf.data() << flush; }