This commit is contained in:
Lily Tsuru 2023-08-22 17:06:36 -04:00
parent 39e4a4bb90
commit 9f3f95d611
1 changed files with 6 additions and 1 deletions

View File

@ -36,8 +36,13 @@ namespace swbf {
template<class ...Args>
inline void fprint(std::FILE* file, std::string_view format, Args&&... args) {
#ifdef _WIN32
// windows vt handling is DOG slow. don't know why lmao
auto str = std::vformat(format, std::make_format_args(args...));
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), str.data(), str.length(), nullptr, nullptr);
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
if(file == stderr)
handle = GetStdHandle(STD_ERROR_HANDLE);
WriteConsole(handle, str.data(), str.length(), nullptr, nullptr);
#else
std::vformat_to(FputcIterator(file), format, std::make_format_args(args...));
#endif