Rewriting multiple lines in C++ terminal application
I have a fairly lengthy C++ terminal application that is doing some heavy maths. Ideally I would like to be able to get a short summary on the screen of what it is currently doing, without it scrolling down a million lines when I run it.
I know how to rewrite one line: Code:
cout << "\r"; This only has to run on Linux, would be nice if it could work off the command line (ie not only a terminal window / don't know if there is a difference). |
Try ncurses. Although this feels like normal log-like behaviour seems like it would work if you were smarter about what and when you logged.
|
There is no portable way to do this using only standard terminal i/o functions. If you really need it, I suggest you try using (n)curses.
|
Quote:
osor << portability is not really too much of an issue, at the moment there are only about 10 machines in the world that I will run this code on. That is fairly unlikely to change. Will give ncurses a look. [*UPDATE*] Read the ncurses howto and it looks like just what I need. Thanks for the advice. |
Alternatively, I found this:
http://66.102.9.104/search?q=cache:D...ient=firefox-a which is a list of all escape sequences for the Linux terminal (or specifically all VT100 terminals). Unfortunately, the original link seems to be broken; I hope you are fine with Google's cache. So basically, to clear the previous two lines, you would do something like this(in C): Code:
#include <stdio.h> This method is more easy on your computer than using curses (which I assume you'll prefer, calculating millions of lines of math). /Siiiiiii |
All times are GMT -5. The time now is 12:40 AM. |