对于C / C交互式控制台++程序? [英] Interactive console programming for c/c++?

查看:132
本文介绍了对于C / C交互式控制台++程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我写了一个小程序,由用户在需要的命令,然后显示输出(连接到服务器后)。这是各种各样的交互式控制台。

So I've written a small program which takes in commands by the users, and then displays the output (after connecting to a server). It's an interactive console of sorts.

然而,使用的MongoDB和Redis的命令行客户端(其中交互工作控制台/终端上)后,似乎有一定的某处库,它提供的功能,如记录用户输入,接受上/下键presses通过命令历史记录,以及标签完成框架(不知道是怎么一会工作,但耶)浏览。

However, after using the mongodb and redis command-line clients (which work interactively on the console/terminal), it seems that there must be a library somewhere which provides functionalities such as recording user inputs, accepting up/down keypresses to browse through command history, as well as tab completion framework (not sure how that one would work, but yeah).

什么是使用这种事的理想库?

What's an ideal library to use for such a thing?

推荐答案

readline库是一个共同的选择: http://www.gnu.org/s/readline

The readline library is a common choice: http://www.gnu.org/s/readline

如果你是更有野心的ncurses给你更多的控制权,但少开始与功能和陡峭的学习曲线。

If you are more ambitious, ncurses gives you more control, but has less functionality to begin with and a steeper learning curve.

编辑:
icktoofay提到的ReadLine是在GPL许可。如果这是你的软件, tecla 的一个问题是一个另类行货下X11风格的许可证,因此它可以在专用的项目中使用。

icktoofay mentioned that readline is licensed under the GPL. If this is a problem for your software, tecla is an alternative licensed under an X11 style license, so it can be used in proprietary projects.

这篇关于对于C / C交互式控制台++程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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