OpenRCT2/test/testpaint/String.cpp

28 lines
772 B
C++
Raw Normal View History

2016-10-16 21:15:40 +02:00
/*****************************************************************************
* Copyright (c) 2014-2018 OpenRCT2 developers
2016-10-16 21:15:40 +02:00
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
2016-10-16 21:15:40 +02:00
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
2016-10-16 21:15:40 +02:00
*****************************************************************************/
#include "String.hpp"
2018-06-22 22:29:03 +02:00
#include <cstdarg>
namespace String
{
std::string Format(const char* format, ...)
2016-10-16 21:15:40 +02:00
{
va_list args;
char buffer[512];
2016-10-16 21:22:18 +02:00
2016-10-16 21:15:40 +02:00
va_start(args, format);
vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
2016-10-16 21:22:18 +02:00
2016-10-16 21:15:40 +02:00
return std::string(buffer);
}
2018-06-22 22:29:03 +02:00
}; // namespace String