How to make text not scroll in terminal

I am trying to write a program in C ++ where the screen is updated every 1 second. However, I want the screen to look like htop, where it is updated and should not scroll with each update. Thus, I do not have stepwise iteration in my terminal.

Does anyone know what this style is called or how to program it?

Thank!

+3
source share
2 answers

The usual way with something like ncurses. If you work on Windows, it has built-in console functions, so you can do the same without any additional libraries (although they need time to understand). If you want only one line of output, you can use '\r'to return to the beginning of the current line and / or \bto return to previous characters (convenient if yoy just wants to rewrite a few small bits and parts).

+5
source

You will need a library like curses (on * nix) or pdcurses for Windows (the conio functions will probably still work on windows).

+3
source

All Articles