c-将终端拆分为多个,并在每个终端上调用程序



我有一个C程序,我想在其中打开2个控制台。一个是我展示地图,另一个是聊天。

现在,我正在控制台上运行程序(地图显示的地方),我打开了第二个控制台,上面写着:

system("xterm ./chat +hold -geometry 60x40+1400+450 -title 'Chat' &");

但这看起来很可怕,所以我想使用gnu屏幕并排设置两个控制台。

我该怎么做?

您可以尝试以下

xterm -geometry 132x50+10+30 -e 'screen -c ./my_special_screenrc'

./my_special_screenrc应该包含

screen -t map  1 ./map     #run the "map" command
screen -t chat 2 ./chat    #run the "chat" command
split
select 1 #the map - defined above
focus
select 2 #the chat

使用以下./map命令进行测试

while :
do
    echo "This is the $0 program"
    sleep 5
done

并且对于聊天CCD_ 3类似。

在上半部分,每隔5秒打印一次

This is the ./map program
This is the ./map program

在的下半部分

This is the ./chat program

最新更新