From a8c7e4a8268cdd144feaee501a59e6d0f53af241 Mon Sep 17 00:00:00 2001 From: fourtf Date: Sat, 13 Mar 2021 12:40:43 +0100 Subject: [PATCH] added missing files --- src/util/AttachToConsole.cpp | 20 ++++++++++++++++++++ src/util/AttachToConsole.hpp | 5 +++++ 2 files changed, 25 insertions(+) create mode 100644 src/util/AttachToConsole.cpp create mode 100644 src/util/AttachToConsole.hpp diff --git a/src/util/AttachToConsole.cpp b/src/util/AttachToConsole.cpp new file mode 100644 index 000000000..b1c993ad4 --- /dev/null +++ b/src/util/AttachToConsole.cpp @@ -0,0 +1,20 @@ +#include "AttachToConsole.hpp" + +#ifdef USEWINSDK +# include +#endif + +namespace chatterino { + +void attachToConsole() +{ +#ifdef USEWINSDK + if (AttachConsole(ATTACH_PARENT_PROCESS)) + { + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); + } +#endif +} + +} // namespace chatterino diff --git a/src/util/AttachToConsole.hpp b/src/util/AttachToConsole.hpp new file mode 100644 index 000000000..9fa8ba7b3 --- /dev/null +++ b/src/util/AttachToConsole.hpp @@ -0,0 +1,5 @@ +#pragma once + +namespace chatterino { +void attachToConsole(); +}