I found a BCX code about making a text based progress bar:
http://d-apps.com/files/coding/bcx/cprog.zip
I tried to rewrite the code in C, and this is the result:
Code:
#include <windows.h>
#include <stdio.h>
void gotoxy(int,int);
int main(){
int iPercent = 10000000;
int rCounter;
int iTmpMth1 = 0;
int iPrevCnt = 0;
CONSOLE_SCREEN_BUFFER_INFO sbi;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &sbi);
for (rCounter = 0; rCounter < iPercent; rCounter++){
iTmpMth1 = 8 + (rCounter / iPercent) * 54;
if (iPrevCnt != iTmpMth1) {
gotoxy(sbi.dwCursorPosition.Y + 3, iTmpMth1);
printf("#");
iPrevCnt = iTmpMth1;
}
}
return 0;
}
void gotoxy(int x, int y){
COORD point;
point.X = x;
point.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), point);
}
Well, no animation there. I can't figure out what's wrong...