简体   繁体   中英

Console overwriting like top

Ok so I was just wondering how console applications like top(1) for linux overwrite multiple lines. I want to know how to do it for C++ or C. I know how to overwrite 1 line by just putting a \\r but I wanted to know how to do so for multiple lines, again like in top or if its even possible.

They use terminal escape sequences to move the cursor around the screen. A few even use direct framebuffer access, to treat the screen as an array of characters which can be directly indexed.

The curses (or ncurses ) library is a good abstraction layer.

这可能无法直接解决问题,但是这种情况取决于终端,通常通过curses实现来完成( ncurses是使用最广泛的)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM