Skip to content
Permalink
Browse files

console: unbreak stdio/stderr redirect on MinGW

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
  • Loading branch information...
tycho committed May 29, 2018
1 parent 9b2c85b commit 8d2ada5e5f4c1f389b4cc9c0d6a095620ea5d2ad
Showing with 2 additions and 3 deletions.
  1. +2 −3 source/console.cpp
@@ -48,12 +48,11 @@ namespace CrissCross
m_consoleAllocated(false)
{
AllocateConsole();
#ifdef TARGET_COMPILER_VC
#ifdef TARGET_OS_WINDOWS
if (m_consoleAllocated) {
/* Redirect stdout to the console. */
int hCrt = _open_osfhandle(( intptr_t )GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
FILE *hf = _fdopen(hCrt, "w");

*stdout = *hf;
int i = setvbuf(stdout, NULL, _IONBF, 0);

@@ -65,7 +64,7 @@ namespace CrissCross

if (_fillScreen) {
char findWindowFlag[64];
sprintf(findWindowFlag, "%s%08X", CC_LIB_NAME, (unsigned long)this);
sprintf(findWindowFlag, "%s%p", CC_LIB_NAME, this);
RECT rect; CONSOLE_SCREEN_BUFFER_INFO csbi;
HWND consoleWindowHandle = NULL;
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);

0 comments on commit 8d2ada5

Please sign in to comment.
You can’t perform that action at this time.