如何防止终端滚动 [英] How to keep the terminal from scrolling

查看:83
本文介绍了如何防止终端滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用C ++编写一个简单的程序,以便在终端窗口中运行.我希望将输出文本锁定在屏幕上的适当位置.我希望能够更改一行文本或一行文本中的某些字符,同时使其上方和下方的其他行保持不变,而不是将每个新行显示在屏幕底部并向上推送所有内容.我知道我已经在终端中看到了这一点,并且我相信它是使用C ++完成的,但是我找不到关于它的任何文档.我什至都无法想到这种显示方式.我的Google Fu使我失败了;请帮忙.如果您能告诉我要使用什么命令/库,那将是很好的,但是即使能够告诉我哪些命令可以用非C ++的编程语言来完成,也比现在有了更多的帮助.

I am writing a simple program in C++ to be run in a terminal window. I would like the output text to be locked in position on the screen. Instead of each new line appearing at the bottom of the screen and pushing everything up, I would like to be able to change a line of text or some characters in a line of text, while keeping other lines above and below it static. I know I have seen this done in terminal, and I believe it was done with C++, but I can't find any documentation on it. I cannot even think of what this type of display might be called. My google fu has failed me; please help. If you can tell me what commands/library to use, that would be great, but even being able to tell me what commands accomplish this in a programming language other than C++ would give me more to go on than I have now.

推荐答案

您想要ncurses,一个用于在终端上显示文本的库.

You want ncurses, a library for displaying text on a terminal.

这篇关于如何防止终端滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆