简体   繁体   English

是否可以在单个C程序中的多个终端窗口上输出?

[英]Is it possible to output on multiple terminal windows within a single C program?

Basically what I'd like to do is have two output terminal windows for a single program. 基本上我想做的是为一个程序提供两个输出终端窗口。 One would be displaying a log of actions being taken by the program, and the second would be displaying something like a table of values. 一个是显示程序正在执行的操作的日志,第二个将显示类似值的表。 All of the output for these terminals would be generated by the program itself. 这些终端的所有输出都将由程序本身生成。 Is this possible to do in C with stdio? 用stdio在C中可以做到这一点吗?

I realise this is probably something more suited for a GUI or ncurses, but I'm still curious as to whether this can be done regardless. 我意识到这可能更适合于GUI或ncurses,但我仍然很好奇是否可以这样做。

Edit: Should probably also mention I'm doing this on linux (xubuntu specifically). 编辑:也许应该提一下我在linux上做这个(特别是xubuntu)。

不是以任何可移植的方式,但在Linux上, /dev/pts是一个包含所有开放ttys的目录,因此写入一些不同的/dev/pts/<n>文件会将输出放在多个终端上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM