Detect console with on Windows

Signed-off-by: Nils Maier <maierman@web.de>
pull/48/head
Nils Maier 2012-06-12 21:58:38 +02:00
parent a49397ed19
commit 11b9f3ebe2
1 changed files with 5 additions and 0 deletions

View File

@ -296,6 +296,11 @@ ConsoleStatCalc::calculateStat(const DownloadEngine* e)
cols = std::max(0, (int)size.ws_col-1); cols = std::max(0, (int)size.ws_col-1);
} }
#endif // HAVE_TERMIOS_H #endif // HAVE_TERMIOS_H
#else // __MINGW32__
CONSOLE_SCREEN_BUFFER_INFO info;
if(::GetConsoleScreenBufferInfo(::GetStdHandle(STD_OUTPUT_HANDLE), &info)) {
cols = std::max(0, info.dwSize.X - 2);
}
#endif // !__MINGW32__ #endif // !__MINGW32__
std::string line(cols, ' '); std::string line(cols, ' ');
global::cout()->printf("\r%s\r", line.c_str()); global::cout()->printf("\r%s\r", line.c_str());