Skip to content
Snippets Groups Projects
Commit b91d9c42 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix

parent d74af1f6
No related branches found
No related tags found
No related merge requests found
......@@ -263,15 +263,18 @@ void RedirectIOToConsole()
// redirect unbuffered stdout, stdin and stderr to the console
intptr_t lStdHandle = (intptr_t)GetStdHandle(STD_OUTPUT_HANDLE);
int hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
*stdout = _fdopen(hConHandle, "w");
FILE *fp = _fdopen(hConHandle, "w");
*stdout = *fp;
setvbuf(stdout, NULL, _IONBF, 0);
lStdHandle = (intptr_t)GetStdHandle(STD_INPUT_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
*stdin = _fdopen(hConHandle, "r");
fp = _fdopen(hConHandle, "r");
*stdin = *fp;
setvbuf(stdin, NULL, _IONBF, 0);
lStdHandle = (intptr_t)GetStdHandle(STD_ERROR_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
*stderr = _fdopen(hConHandle, "w");
fp = _fdopen(hConHandle, "w");
*stderr = *fp;
setvbuf(stderr, NULL, _IONBF, 0);
// make cout, wcout, cin, wcin, wcerr, cerr, wclog and clog point to
// console as well
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment