使用 C++ 在 GNU/Linux 上编写控制台应用程序的正确方法
我真的很喜欢这个控制台,并且最近迷上了使用 nCurses 主要与 C 编程语言结合使用的控制台应用程序。
不幸的是,我认为 ncurses API 完全无聊并且很难使用,并且 C++ 绑定没有文档记录。
所以我的问题是,用于 C++ 控制台应用程序的 API 是什么?
I really like the console and got recently hooked on programming console applications using nCurses mainly in conjunction with the C programming language.
Unfortunately i think the ncurses API is totally borked and very hard to use, and the C++ bindings are undocumented.
So my question is, what is THE API to use for C++ console applications?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
简短的回答:取决于您的需求;)
仍然简短的回答:许多工具不是交互式的(cat、sed、wc),因此您不需要像 ncurses 这样的东西。如果您需要基于命令行的东西,那么您可以使用 Readline。
最后,您似乎喜欢的只是带有 2D 布局的基于文本的 GUI。在这种情况下我不知道;)
Short answer: depends on your needs ;)
Still short answer: many tools aren't interactive (cat, sed, wc), so you don't need anything like ncurses. If you need something commandline based, then you have Readline.
At last, what you seem to like, is just a text based GUI with a 2D layout. In this case I don't know ;)
也许您更喜欢 s-lang ?
maybe you'd like s-lang better?
您不会考虑使用转义序列来设置颜色、光标位置等吗?这是我唯一能想到的。查看此链接此处,其中显示了如何打印颜色字符串。转义序列来自 ANSI 标准,也在此处列出。
希望这有帮助,
此致,
汤姆.
Would you not consider using escape sequences to set the colours, cursor positions and so on? That is the only thing I can think of. Have a look at this link here which shows how to print a colour string. The escape sequences are from the ANSI standards, also listed here.
Hope this helps,
Best regards,
Tom.
它不完全是 API,但在过去 borland Turbovision 库很流行。
Borland 几年前将源代码发布到公共领域,并且有好人移植了它。
这里是:
http://tvision.sourceforge.net/
显然他们在 2007 年就停止发布了。
It isn't exactly THE API, but in the olden times borland turbovision library was popular.
Borland released the source to public domain some years ago, and good people ported it.
Here it is:
http://tvision.sourceforge.net/
Apparently they stopped making releases in 2007.