C++ ncurses 可用于 Windows 吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/138153/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is ncurses available for windows?
提问by gio
Are there any ncurses libraries in C/C++ for Windows that emulate ncurses in native resizable Win32 windows (notin console mode)?
是否有适用于 Windows 的 C/C++ 中的任何 ncurses 库在本机可调整大小的 Win32 窗口(不在控制台模式下)中模拟 ncurses ?
采纳答案by wbruna
There's an ongoing effort for a PDCurses port:
有一个 PDCurses 端口的持续努力:
http://www.mail-archive.com/[email protected]/msg00129.html
http://www.mail-archive.com/[email protected]/msg00129.html
回答by Adam Batkin
Such a thing probably does not exist "as-is". It doesn't really exist on Linux or other UNIX-like operating systems either though.
这样的事情可能“原样”不存在。不过,它也不存在于 Linux 或其他类 UNIX 操作系统上。
ncurses is only a library that helps you manage interactions with the underlying terminal environment. But it doesn't provide a terminal emulator itself.
ncurses 只是一个帮助您管理与底层终端环境交互的库。但它本身不提供终端模拟器。
The thing that actually displays stuff on the screen (which in your requirement is listed as "native resizable win32 windows") is usually called a Terminal Emulator. If you don't like the one that comes with Windows (you aren't alone; no person on Earth does) there are a few alternatives. There is Console, which in my experience works sometimes and appears to just wrap an underlying Windows terminal emulator (I don't know for sure, but I'm guessing, since there is a menu option to actually get access to that underlying terminal emulator, and sure enough an old crusty Windows/DOS box appears which mirrors everything in the Console window).
在屏幕上实际显示内容的东西(在您的要求中列为“本机可调整大小的 win32 窗口”)通常称为终端模拟器。如果您不喜欢 Windows 附带的那个(您并不孤单;地球上没有人喜欢),还有一些选择。有Console,根据我的经验,它有时会起作用,并且似乎只是包装了一个底层的 Windows 终端模拟器(我不确定,但我猜,因为有一个菜单选项可以实际访问该底层终端模拟器,果然出现了一个旧的硬壳 Windows/DOS 框,它反映了控制台窗口中的所有内容)。
A better option
更好的选择
Another option, which may be more appealing is puttycyg. It hooks in to Putty (which, coming from a Linux background, is pretty close to what I'm used to, and free) but actually accesses an underlying cygwin instead of the Windows command interpreter (CMD.EXE
). So you get all the benefits of Putty's awesome terminal emulator, as well as nice ncurses
(and many other) libraries provided by cygwin. Add a couple command line arguments to the Shortcut that launches Putty (or the Batch file) and your app can be automatically launched without going through Putty's UI.
另一种可能更有吸引力的选项是puttycyg。它连接到 Putty(它来自 Linux 背景,非常接近我习惯的并且免费),但实际上访问的是底层 cygwin 而不是 Windows 命令解释器 ( CMD.EXE
)。因此,您可以获得 Putty 出色的终端模拟器的所有好处,以及ncurses
cygwin 提供的漂亮(和许多其他)库。向启动 Putty(或批处理文件)的快捷方式添加几个命令行参数,您的应用程序可以自动启动,而无需通过 Putty 的 UI。