在单独的终端上从Ncurses应用获取输出 [英] Get output from Ncurses app on a separate terminal
问题描述
我想要一个解决方案,允许我将ncurses
应用程序分离到另一个终端仿真器窗口,并查看当前命令中诸如"cout"之类的标准命令的输出-用于调试等.
I would like a solution that allows me to detach a ncurses
app to a different terminal emulator window and view the output of standard commands like 'cout' in the current one - for debugging and such.
我见过很多写到文件并使用tail
的解决方案,但这似乎很麻烦而且很慢.顺便提一句.我什至不知道从哪里开始,我对ncurses还是很陌生.
I've seen a lot of solutions that write to a file and use tail
but that seems quite hacky and slow. BTW. I have no idea where to even begin, I'm quite new with ncurses.
推荐答案
您可以通过以下两种方式之一初始化curses:
You can initialize curses in one of two ways:
-
使用
initscr
(使用标准输入/输出),或
using
initscr
(which uses the standard input/output), or
使用 newterm
(可让您指定要使用的输入/输出)
using newterm
(which lets you specify which input/output to use)
例如,ncurses测试程序 c4>使用newterm
打开一个或多个xterm的输出显示.这是屏幕截图:
For example, the ncurses test-program ditto
uses newterm
to open output displays on one or more xterm's. Here is a screenshot:
原则上,您可以使用 current 终端进行输入,并在另一个 上显示ncurses输出 终端(不过,我暂时不记得有任何有用的程序可以执行此操作,仅演示).
In principle, you could use the current terminal for input, and display ncurses output on another terminal (though offhand, I don't recall any useful programs which do this — only demos).
这篇关于在单独的终端上从Ncurses应用获取输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!