Progress bar in C

Progress bar in C

Post by Anita Zahar » Wed, 02 Aug 2000 04:00:00



Hi,

I'm using Red Hat Linux 6.2, and would like to make a progress bar
program using C. Any suggestion where should I start??

can anyone point me out any
progress bar sample that I can look at?

Thank you,
anita

 
 
 

Progress bar in C

Post by Jan Pantelt » Wed, 02 Aug 2000 04:00:00


Quote:>Hi,

>I'm using Red Hat Linux 6.2, and would like to make a progress bar
>program using C. Any suggestion where should I start??

>can anyone point me out any
>progress bar sample that I can look at?

>Thank you,
>anita

in X you could use a GUI builder like xforms
http://world.std.com/~xforms
Its form generator fdesign  will generate a complete C program.
You can put objects like a slider on the form(s), and then set the slider
(or whatever) from withing your program.
xforms is free for non commmericial use, and has a lot of widgets.
You could also use gtk, http://www.gtk.org/
to do soemthing similar.
If you dont use X, maybe print some black characters like spaces in ncurses?

--------------
*****          40%
--------------
Primitive but it works.
Jan

 
 
 

Progress bar in C

Post by Bruno Barberi Gnecc » Wed, 02 Aug 2000 04:00:00



> >Hi,

> >I'm using Red Hat Linux 6.2, and would like to make a progress bar
> >program using C. Any suggestion where should I start??

> >can anyone point me out any
> >progress bar sample that I can look at?
> If you dont use X, maybe print some black characters like spaces in ncurses?

> --------------
> *****          40%
> --------------
> Primitive but it works.

        You don't need ncurses. Use '\r' instead of '\n'; it will do a carriage
return without a line feed. See the C FAQ.

--

http://www.geocities.com/RodeoDrive/1980/
Quoth the Raven, "Nevermore". - Poe

 
 
 

Progress bar in C

Post by spi.. » Wed, 02 Aug 2000 04:00:00



Quote:> Hi,
> I'm using Red Hat Linux 6.2, and would like to make a progress bar
> program using C. Any suggestion where should I start??
> can anyone point me out any
> progress bar sample that I can look at?

The GTK widget set has a progress bar widget...
In fact, I think most widget sets do... Why do you want to re-invent the
wheel when there are a lot of predesigned, streamlined and tested wheels out
there?

--
______________________________________________________________________________

|Andrew Halliwell BSc(hons)| "The day Microsoft makes something that doesn't |
|            in            |  suck is probably the day they start making     |
|     Computer science     |  vacuum cleaners" - Ernst Jan Plugge            |
------------------------------------------------------------------------------

 
 
 

1. Simple counter/progress "bar"

I don't mean a "progress bar" per se.  I wonder if this is possible to
create some kind of a counter that would show where I'm at while in the
sleep mode (or counting number of seconds).

So far, the only reasonable thing I could come up with was this crude piece
of code:

j=0
while true; do
    j=$(($j+1))
    echo "$j"
    sleep 1
    clear
done;

This is just to show roughly what I have in mind.  More practical
application would be, let's say, something like this:

#!/bin/sh
i=1

while true; do

myDate=`/bin/date +'%B %d, %Y %r'`
myMessage=`wc -c /var/spool/mail/user | /bin/awk '{ print $1 }'`
myCheck=`/usr/bin/messages | /bin/awk '{ print $3 }'`
myLine="---------------------------------------------" <-- is there a
"repeat" equivalent in Bourne shell so I don't have to type it?

 clear
 echo ""
 echo "Messages will be checked every 3 minutes."
 echo "$myLine"
 echo "This is check $i"
 echo "$myLine"
 echo ""

  if [ "$myMessage" -eq 0 -o "$myMessage" -eq 513 ]; then
   echo "$USER has 0 messages"
  elif [ "$myCheck" -eq 1 ]; then
   echo "$USER has $myCheck message."
  else
   echo "$USER has $myCheck messages."
  fi;

  echo ""
  echo "Check for new messages was done on $myDate"

  i=$(($i+1))

 echo "Going to sleep..."

 sleep 180 <-- This is the piece where I'd rather have an active counter
than a message simply saying "Going to sleep."  I assume that what I ask for
can be quite complex.  If so, how much complex?

done;
exit 0

Thanks.

--
Bolek,

URL: http://www.bolek.com

ICQ: 4086197
Address: 402905326

2. X3270 on Solaris 2.4 ER II

3. shell progress bar of square cursors

4. Help, Solaris experts

5. Progress Bar Widget - help please

6. bincancel:20 large binaries:AR478:@@NCM

7. how to turn off the fsck progress bar?

8. using rdist, when destination directory has a different name

9. progress bar in X

10. progress bar under ksh or bash

11. Fetechmail replacement with progress-bar?

12. how to disable fsck progress bar?

13. FreeBSD Newbie Progress Day 5 (Making Progress)