|
-
Nov 13th, 2002, 03:49 PM
#1
Thread Starter
Lively Member
This should be simple?!?!
Hi!
I want to make a kind of progressbar in dos?
Lets say when I read a text file I want the text in dos to be
"Opening text file... (5%)"
and the 5% should increase untill 100% when
thow whole file is read.
And only the 5% should be rewritten some how?
-
Nov 13th, 2002, 03:51 PM
#2
Monday Morning Lunatic
Use the "\b" character (backspace).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 14th, 2002, 02:57 AM
#3
Thread Starter
Lively Member
well!! I tryed this but it only shows the final resault 100%
and I want to be able to see every %
#include <iostream.h>
#include <time.h>
int main(){
double sec;
sec = 0.1; // the time delay in sec
clock_t delay = sec * CLOCKS_PER_SEC;
cout << "0";
for(int n=0; n<=100; n++){
if(n>9){
cout << "\b\b\b";
}
else{
cout << "\b\b";
}
cout << n << "%";
clock_t start = clock();
while(clock() -start < delay){} // the delay
}
return 0;
}
-
Nov 14th, 2002, 03:32 AM
#4
Monday Morning Lunatic
Insert flush onto the stream after you've printed the characters
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Nov 14th, 2002, 03:49 AM
#5
Thread Starter
Lively Member
yea now it works
Thankz!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|