Results 1 to 5 of 5

Thread: This should be simple?!?!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Location
    Sweden, Sthlm
    Posts
    112

    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?

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Location
    Sweden, Sthlm
    Posts
    112
    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;
    }

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2001
    Location
    Sweden, Sthlm
    Posts
    112
    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
  •  



Click Here to Expand Forum to Full Width