diff options
author | Oliver Schneider <oliver@assarbad.net> | 2014-01-27 02:30:08 +0400 |
---|---|---|
committer | Oliver Schneider <oliver@assarbad.net> | 2014-01-27 02:30:08 +0400 |
commit | 33670c8ea556a7c9b2f6a8ff218dab70338caba3 (patch) | |
tree | d0cf3843786528dc6051def4b398832e567f46a3 /common | |
parent | 3e53ded94714323f8603215eabacc8bffcd77a08 (diff) |
Wait before closing the console window
Diffstat (limited to 'common')
-rw-r--r-- | common/tracer.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/common/tracer.cpp b/common/tracer.cpp index b2899d5..2982314 100644 --- a/common/tracer.cpp +++ b/common/tracer.cpp @@ -35,15 +35,18 @@ #include <cstdarg>
#include <fcntl.h>
#include <io.h>
+#include <conio.h>
#if VTRACE_TO_CONSOLE
CWDSTracerConsole::CWDSTracerConsole()
{
+ int hCrt;
+ FILE *hf;
::AllocConsole();
::SetConsoleTitle(_T("WinDirStat debug trace output"));
// Standard output
- int hCrt = _open_osfhandle((intptr_t)::GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
- FILE *hf = _fdopen(hCrt, "w");
+ hCrt = _open_osfhandle((intptr_t)::GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
+ hf = _fdopen(hCrt, "w");
*stdout = *hf;
setvbuf(stdout, NULL, _IONBF, 0);
// Standard error
@@ -55,6 +58,8 @@ CWDSTracerConsole::CWDSTracerConsole() CWDSTracerConsole::~CWDSTracerConsole()
{
+ _tprintf(_T("Press a key to continue/close.\n"));
+ _getch();
::FreeConsole();
}
#endif // VTRACE_TO_CONSOLE
|