Re: (C) Simulated progress bar

From: Chris \( Val \) (chrisval_at_bigpond.com.au)
Date: 11/18/04

  • Next message: Richard Seguin: "Re: What are the benefits?"
    Date: Thu, 18 Nov 2004 22:01:34 +1100
    
    

    "Paul Fedorenko" <pfedorenko@look.ca> wrote in message
    news:mxAld.52481$Z7.1566655@news20.bellglobal.com...
    | My friend, the psychologist, who asked me to put together a little program
    | for him has asked me if I could get the program to pause for a second
    | between turns and to display a progress indicator to make it look like the
    | program's running some calculations in the background.
    |
    | I'm thinking the progress bar would be fairly straight-forward... Just a
    | for loop, set up to display a bunch of hashmarks or ASCII block characters
    | one at a time... How would I get it to take a second or two to run through
    | the loop? That sounds like an awfully long time.

    This is best performed via extensions provided by your
    implementation, however, you can write a simple busy
    loop as already discussed, using the functionality
    found in 'time.h'.

    As for the ASCII characters, you could if you like imitate
    a progress wheel, by displaying each character in an timely
    fashion from an array:

    const char Symbol[] = {'/', '-', '|', '-', '\\', '|'};

    Cheers.
    Chris Val


  • Next message: Richard Seguin: "Re: What are the benefits?"

    Relevant Pages

    • Accessing characters in character array
      ... The input is a stream of characters which represent the value ... and suit of the card. ... points but also display the cards of a particulier hand by suit. ... To print out the values by rank I have used this while loop sequence: ...
      (comp.lang.cpp)
    • Access one character in an array of characters
      ... The input is a stream of characters which represent the value ... and suit of the card. ... points but also display the cards of a particulier hand by suit. ... To print out the values by rank I have used this while loop sequence: ...
      (alt.comp.lang.learn.c-cpp)
    • [PATCH 15/19] TuxOnIce: Userspace user interface support.
      ... +static int userui_storage_needed ... * Side effect routine for when the userui program is set. ... * @value: Current progress percentage numerator. ... Whether to pause or just display the message. ...
      (Linux-Kernel)
    • Re: Best way to report progress at fixed intervals
      ... Work through all 20 steps reporting progress every 1.0 secs... ... progress at regular intervals" approach presented here. ... while the main thread does the monitoring. ... or instead of the loop counter. ...
      (comp.lang.python)
    • Re: malloc + 4??
      ... >the screen or to a file, there aren addition 4 characters. ... This loop tries to count the size of the file by calling getc ... until getcreturns EOF. ... yet also return the special marker value EOF. ...
      (comp.lang.c)

    Loading