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.
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.
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
Why do you want to avoid curses, and not go the standard way ?
-Michael
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".
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
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.