need to clear the current line output

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
i have an embedded linux application that does not have curses library
support.
i would like to be able write a functino that will clear current output
line.

is it possible to do this without curses lib support?

thank you in advance.


Re: need to clear the current line output
["Followup-To:" header set to comp.os.linux.misc.]
On 2 Jun 2006 16:00:38 -0700, snipped-for-privacy@gmail.com staggered into the Black
Sun and said:
Quoted text here. Click to load it

New to programming, eh?  libncurses finds what TERM is set to, then
looks up the "clear current line" escape sequence for that TERM using
terminfo, then outputs that sequence.  Since you say this is an embedded
app, you already know what TERM is and what the escape sequences are for
that TERM.  You just have to fprintf() (putc(), write(), whatever...)
the right sequence.  "man console_codes" for the standard sequences that
work on TERM=linux (almost all of those work on TERM=xterm as well,
IIRC) and you want to search for "erase".  HTH,

--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /    mail: TRAP + SPAN don't belong
We've slightly trimmed the long signature. Click to see the full one.
Re: need to clear the current line output
Quoted text here. Click to load it

Why do you want to avoid curses, and not go the standard way ?

-Michael

Re: need to clear the current line output
Quoted text here. Click to load it



if the line is 80 chars long, but writing the last character will wrap to
next line then write a carriage-return "\r" then 79 spaces, then another
carriage-return "\r".

Re: need to clear the current line output
Quoted text here. Click to load it

   If it's embedded, there presumably can be no question about what
   control sequences are needed to do the job.

   The vast majority of terminals support the ANSI codes, in which
   clear to end of line is ESC [ K.

--
   Chris F.A. Johnson, author              <http://cfaj.freeshell.org
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline