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

@ -80,15 +80,17 @@
#endif
#if defined(WIN32)
#include <windows.h>
#include <shlwapi.h>
#include <windows.h>
#include <shlwapi.h>
#include <io.h>
#include <fcntl.h>
#elif defined (__MINT__)
#include <mint/osbind.h>
#include <mint/osbind.h>
#elif defined(__macosx__)
#import <CoreFoundation/CoreFoundation.h>
#import <sys/param.h>
#import <CoreFoundation/CoreFoundation.h>
#import <sys/param.h>
#elif defined(__FreeBSD__)
#include <sys/param.h>
#include <sys/param.h>
#endif
#if defined(__macosx__)
@ -985,8 +987,19 @@ int Init_program(int argc,char * argv[])
}
}
// Open a console for debugging...
//ActivateConsole();
if ((unsigned)GFX2_verbosity_level >= (unsigned)GFX2_DEBUG)
{
// Open a console for debugging...
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
Main.image_width=Screen_width/Pixel_width;