From 267382af395f152c8b83726151237291d8fa5aa6 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 9 Feb 2015 06:53:05 -0800 Subject: [PATCH] Revert the experimental fix for print_colored that didn't work --- format.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/format.cc b/format.cc index 1e874cac..9005302c 100644 --- a/format.cc +++ b/format.cc @@ -40,7 +40,6 @@ # include # endif # include -# include // for _get_osfhandle #endif using fmt::internal::Arg; @@ -1113,7 +1112,9 @@ FMT_FUNC void fmt::print(std::ostream &os, StringRef format_str, ArgList args) { FMT_FUNC void fmt::print_colored(Color c, StringRef format, ArgList args) { #ifdef _WIN32 - HANDLE handle = reinterpret_cast(_get_osfhandle(_fileno(stdout))); + HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE); + if (handle == INVALID_HANDLE_VALUE) + FMT_THROW(WindowsError(GetLastError(), "cannot get output handle")); CONSOLE_SCREEN_BUFFER_INFO info_con; if (!GetConsoleScreenBufferInfo(handle, &info_con)) FMT_THROW(WindowsError(GetLastError(), "cannot get console information"));