castord wrote:
| how can I update a text line without clearing the screen?
|
| I want to show a progress info but seems impossible to update a line to
| increase the percent number of my script.
|
| I always clear the screen and then print the data updated in the same
| position but this solution is dirty and I don’t like it.
|
| Every program I use use this feature and it would be very useful to me.
|
| I use Perl and C++.
|
| Thanks.
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
On Fri, 2008-06-20 at 17:58 +0000, cjcox wrote:
> On Fri, 2008-06-20 at 17:16 +0000, castord wrote:
> > how can I update a text line without clearing the screen?
>
> The “right” way is to query the terminal capabilities database
> for the appropriate value (man terminfo).
>
> So, for example, consider:
> echo “hello $(tput cr)H”
Oh… and obviously you can query terminal capabilities from
other languages, I just used shell out of convenience.
Capabilities can include all sorts of cursor movements and
even the setting of colors and character definitions, etc.
Popular library to use is curses (ncurses). It’s a higher
level library than includes things to make terminal based
windows, scrolling, etc.