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

Comparing trunk/src/utils/ProgressBar.cpp (file contents):
Revision 1782 by gezelter, Wed Aug 22 02:28:28 2012 UTC vs.
Revision 1790 by gezelter, Thu Aug 30 17:18:22 2012 UTC

# Line 98 | Line 98 | namespace OpenMD {
98  
99   #ifdef _MSC_VER
100          CONSOLE_SCREEN_BUFFER_INFO csbi;
101 <        int ret = GetConsoleScreenBufferInfo(GetStdHandle( STD_OUTPUT_HANDLE ),
102 <                                             &csbi);
101 >        HANDLE hConsole = GetStdHandle( STD_OUTPUT_HANDLE );
102 >        int ret = GetConsoleScreenBufferInfo(hConsole, &csbi);
103          if(ret) {
104 <          width = csbi.dwSize.X;
104 >          width = csbi.dwSize.X - 1;
105          }
106   #else
107          struct winsize w;
# Line 134 | Line 134 | namespace OpenMD {
134            struct tm * ender = localtime(&end_);
135            char buffer[22];
136            strftime(buffer, 22, "%a %b %d @ %I:%M %p", ender);
137 <          
137 >
138 > #ifdef _MSC_VER
139 >          csbi.dwCursorPosition.X = 0;
140 >          SetConsoleCursorPosition(hConsole, csbi.dwCursorPosition);
141 > #else          
142            cout << '\r';
143 + #endif
144            cout.width(3);
145            cout << right << int(percent);
146            cout.width(3);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines