diff --git a/src/fprint.hpp b/src/fprint.hpp index 1a24b66..22e5bc0 100644 --- a/src/fprint.hpp +++ b/src/fprint.hpp @@ -5,6 +5,11 @@ #include #include +#ifdef _WIN32 +#define _WIN32_LEAN_AND_MEAN +#include +#endif + namespace swbf { struct FputcIterator { using iterator_category = std::output_iterator_tag; @@ -30,6 +35,11 @@ namespace swbf { /// Poor Man's C++23 template inline void fprint(std::FILE* file, std::string_view format, Args&&... args) { +#ifdef _WIN32 + auto str = std::vformat(format, std::make_format_args(args...)); + WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), str.data(), str.length(), nullptr, nullptr); +#else std::vformat_to(FputcIterator(file), format, std::make_format_args(args...)); +#endif } } // namespace swbf