View previous topic :: View next topic |
Author |
Message |
OdinsDream Veteran
Joined: 01 Jun 2002 Posts: 1057
|
Posted: Mon Sep 23, 2002 10:56 pm Post subject: Basic C/C++ stdout question. Print on top of other things? |
|
|
Many programs show their output in a progress-bar fashion, and I can understand how one can say, "Print out a period every 100 items..." or, something simple like that.
What I'm wondering, though, is how something like wget works, Where the progress bar is drawn...
[ ]
and then filled in later
[ >> ]
In other words, it's not like a stack of characters. It's the ability to jump back through the stream, and change the items that were already printed out. How can this be done?
I've tried using cout.tellp() in hopes of finding out that I could fseek() backwards, but this results in compile errors.
Again, a simple question, I know... but something I've never figured out. Thanks for any help. |
|
Back to top |
|
|
rac Bodhisattva
Joined: 30 May 2002 Posts: 6553 Location: Japanifornia
|
Posted: Mon Sep 23, 2002 11:28 pm Post subject: Re: Basic C/C++ stdout question. Print on top of other thing |
|
|
OdinsDream wrote: | Again, a simple question, I know |
Actually, it is anything but simple. C++ iostreams have no notion of screen representation. wget uses a trick of outputting ASCII BS ^H and CR ^M to do that printing magic in a terminal window. See bar_set_params in progress.c for details. _________________ For every higher wall, there is a taller ladder |
|
Back to top |
|
|
OdinsDream Veteran
Joined: 01 Jun 2002 Posts: 1057
|
Posted: Tue Sep 24, 2002 5:12 pm Post subject: |
|
|
Interesting... so there's no class available for this type of manipulation?
I'll take a look at the file you mention, thanks for the tips. |
|
Back to top |
|
|
TripKnot Apprentice
Joined: 29 May 2002 Posts: 213
|
Posted: Wed Sep 25, 2002 9:54 pm Post subject: |
|
|
Hmmm, I've written some apps where I can freely place the cursor where ever I want using the window(x1,y1,x2,y2) function. It might be in conio.h. There may be a similar function to get the current cursor position and in combination with window you can do the progress bat you want. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|