Win32: open a console for debugging when -v option is passed

This commit is contained in:
Thomas Bernard 2019-02-20 13:25:08 +01:00
parent b5d61472e5
commit 7f78f3ec72
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -82,6 +82,8 @@
#if defined(WIN32) #if defined(WIN32)
#include <windows.h> #include <windows.h>
#include <shlwapi.h> #include <shlwapi.h>
#include <io.h>
#include <fcntl.h>
#elif defined (__MINT__) #elif defined (__MINT__)
#include <mint/osbind.h> #include <mint/osbind.h>
#elif defined(__macosx__) #elif defined(__macosx__)
@ -985,8 +987,19 @@ int Init_program(int argc,char * argv[])
} }
} }
if ((unsigned)GFX2_verbosity_level >= (unsigned)GFX2_DEBUG)
{
// Open a console for debugging... // Open a console for debugging...
//ActivateConsole(); if (AllocConsole())
{
HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
int hCrt = _open_osfhandle((long) handle_out, _O_TEXT);
FILE* hf_out = _fdopen(hCrt, "w");
setvbuf(hf_out, NULL, _IONBF, 2);
*stdout = *hf_out;
*stderr = *hf_out;
}
}
#endif #endif
Main.image_width=Screen_width/Pixel_width; Main.image_width=Screen_width/Pixel_width;