mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-29 21:36:54 +00:00
formated C string to C++
This commit is contained in:
parent
35991fcd15
commit
dd6ebdeb4f
1 changed files with 6 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <vector>
|
||||||
#include "Log.hpp"
|
#include "Log.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -89,6 +90,10 @@ void Log::print(int level, const char *file, int line, const char *message, ...)
|
||||||
sstr << '\n';
|
sstr << '\n';
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, message);
|
va_start(args, message);
|
||||||
vprintf(sstr.str().c_str(), args);
|
vector<char> buf(vsnprintf(NULL, 0, sstr.str().c_str(), args) + 1);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
va_start(args, message);
|
||||||
|
vsnprintf(buf.data(), buf.size(), sstr.str().c_str(), args);
|
||||||
|
va_end(args);
|
||||||
|
cout << buf.data() << flush;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue