ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/utils/ProgressBar.cpp
(Generate patch)

Comparing branches/development/src/utils/ProgressBar.cpp (file contents):
Revision 1665 by gezelter, Tue Nov 22 20:38:56 2011 UTC vs.
Revision 1767 by gezelter, Fri Jul 6 22:01:58 2012 UTC

# Line 42 | Line 42
42  
43   #include <iostream>
44   #include <cstdlib>
45 +
46 + #ifdef _MSC_VER
47 + #include <Windows.h>
48 + #include <stdio.h>
49 + #include <io.h>
50 + #define isatty _isatty
51 + #define fileno _fileno
52 + #else
53   #include <cstdio>
54   #include <sys/ioctl.h>
55 < #include <unistd.h>
55 > #endif
56 >
57   #ifdef IS_MPI
58   #include <mpi.h>
59   #endif
60 +
61   #include "utils/ProgressBar.hpp"
62  
63   using namespace std;
# Line 85 | Line 95 | namespace OpenMD {
95        // only do the progress bar if we are actually running in a tty:
96        if (isatty(fileno(stdout))  && (getenv("SGE_TASK_ID")==NULL)) {    
97          // get the window width:
98 +
99 + #ifdef _MSC_VER
100 +        CONSOLE_SCREEN_BUFFER_INFO csbi;
101 +        int ret = GetConsoleScreenBufferInfo(GetStdHandle( STD_OUTPUT_HANDLE ),
102 +                                             &csbi);
103 +        if(ret) {
104 +          width = csbi.dwSize.X;
105 +        }
106 + #else
107          struct winsize w;
108          ioctl(fileno(stdout), TIOCGWINSZ, &w);
109          width = w.ws_col;
110 + #endif
111  
112          // handle the case when the width is returned as a nonsensical value.
113          if (width <= 0) width = 80;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines