need to clear the current line output - Embedded

This is a discussion on need to clear the current line output - Embedded ; 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 ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: need to clear the current line output

  1. need to clear the current line output

    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.


  2. 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, mcharon@gmail.com staggered into the Black
    Sun and said:
    > I have an embedded linux application that does not have curses library
    > support. I would like to be able write a [function] that will clear
    > current output line. Is it possible to do this without curses lib
    > support?


    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
    http://www.brainbench.com / "He is a rhythmic movement of the
    -----------------------------/ penguins, is Tux." --MegaHAL

  3. Re: need to clear the current line output

    > is it possible to do this without curses lib support?
    >


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

    -Michael

  4. Re: need to clear the current line output

    In comp.os.linux.embedded mcharon@gmail.com wrote:
    > 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.


    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".

  5. Re: need to clear the current line output

    On 2006-06-02, mcharon@gmail.com wrote:
    > 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?


    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
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
    ===== My code in this post, if any, assumes the POSIX locale
    ===== and is released under the GNU General Public Licence

+ Reply to Thread