c++ - 我可以打印到始终显示的 Windows 控制台数据吗?
问题描述
我有一个控制台程序,我想在前几行中显示一些状态,同时保持其余行的普通输入/输出日志记录行为。
我试图在这里说明它:
+-----------------------------+ <-+
/ state1: abcdef / | // this always stays at the top of the console
/ state2: 012345 / | // this is the behavior that deviates from normal
+-----------------------------+ <-+
1st input ^ <-+
2nd input | | // this scrolls upward as usual for the console
3rd input | | // displaying past inputs/outputs
4th input | <-+
5th in_ <-- // normal console input + carot
我尝试输出整个控制台窗口的内容来模拟这一点,但它不会立即更新,视觉上会撕裂,而且通常很挑剔,因为它取决于控制台窗口的大小。
是否可以让控制台或类似窗口的控制台之类的东西来执行这种行为?如果滚动变得不可能,那也没关系。
解决方案
推荐阅读
- google-chrome - Google Cloud Platform 无法将以 .web.app 结尾的 URI 添加到 Oauth 客户端 ID
- docker - Nginx 不以 docker-compose 运行命令启动
- android - 在我的颤振应用程序中调用页面时,无需直接传递来自另一个类的变量
- ruby-on-rails - 通过 trix 删除 amazon s3 中的对象
- terraform - Terraform:无效或未知密钥:launch_template (aws_launch_template aws_eks_node_group)
- javascript - 需要一种算法来调整组织结构图的大小以适应窗口
- python-3.x - 在我自己训练的 Keras 模型中预测我的图像的问题
- python - Tkinter:基于 Radiobutton 替换图像
- python - 执行 Python re.sub 时如何忽略一些分隔文本
- javascript - jQuery延迟异常-在对象中存储带有连字符的API属性