--- branches/development/src/utils/ProgressBar.cpp 2012/07/05 17:08:25 1766 +++ branches/development/src/utils/ProgressBar.cpp 2012/07/06 22:01:58 1767 @@ -42,12 +42,22 @@ #include #include + +#ifdef _MSC_VER +#include +#include +#include +#define isatty _isatty +#define fileno _fileno +#else #include #include -#include +#endif + #ifdef IS_MPI #include #endif + #include "utils/ProgressBar.hpp" using namespace std; @@ -85,9 +95,19 @@ namespace OpenMD { // only do the progress bar if we are actually running in a tty: if (isatty(fileno(stdout)) && (getenv("SGE_TASK_ID")==NULL)) { // get the window width: + +#ifdef _MSC_VER + CONSOLE_SCREEN_BUFFER_INFO csbi; + int ret = GetConsoleScreenBufferInfo(GetStdHandle( STD_OUTPUT_HANDLE ), + &csbi); + if(ret) { + width = csbi.dwSize.X; + } +#else struct winsize w; ioctl(fileno(stdout), TIOCGWINSZ, &w); width = w.ws_col; +#endif // handle the case when the width is returned as a nonsensical value. if (width <= 0) width = 80;