C 打印文本行并更新它们
我有一个 C 语言程序可以打印表格。我想更新该表的值而不重新打印整个表。我可以使用 \r
字符更新一行,但如何更新多行呢?
I have a program in C that print a table. I want update the values of this table without reprint the entire table. I can update one line with \r
character, but how I can update more than one line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您正在谈论将表输出到定向到控制台(终端)的标准输出。在 C 中没有操作终端的标准方法,因为它的存在甚至不需要标准输出工作(例如,它可能很好地定向到文件)。
但是,有一些多平台库(例如 ncurses)可以在终端上运行。您可能会考虑使用它们。
I assume you are talking about outputing the table to stdout which is directed to a console (terminal). There is no standard way of manipulating the terminal in C because its presence it's not even required for standard output to work (it might be very well directed to a file, for example).
There are, however, multi-platform libraries such as ncurses that can operate on a terminal. You might consider using them.