win32: work around unknown glitch with stdio attachment in visual studio command prompt

This commit is contained in:
zeromus 2009-06-10 20:59:57 +00:00
parent 7d69942bbb
commit 5e3e6f8676
1 changed files with 3 additions and 0 deletions

View File

@ -71,6 +71,9 @@ void OpenConsole()
//redirect stdio
long lStdHandle = (long)hConsole;
int hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
if(hConHandle == -1)
return; //this fails from a visual studio command prompt
FILE *fp = _fdopen( hConHandle, "w" );
*stdout = *fp;
//and stderr