I would like to know how to hook up an xterm to another process.
Here is a high level view of what I am looking for
Main program starts
It creates an new xterm window
It then forks a second process & passes the xterm handle to it
The second process uses the second xterm for input & output
A slightly different idea would be, one process making threads, and each thread has its own xterm. I don't know if this is possible because AFAIK, the standard file descriptors apply to the whole process an not individual threads.
I am afraid if the "xterm -e foo.exe" will work for me.
Any ideas ?
Can I use a pty just like a file ?
From your description, it's difficult to know if U program in C, XWindow, or scripting in Perl, ksh or dtksh... but maybe the easiest way is to use named pipes.
Simply creates your named pipes and read/write to them from any process or thread...
For example, main process creates 5 threads, each thread create his named pipe and write data to his named pipe, main process then creates 5 xterm process reading and printing each named pipes...
Also, if the data is not volatile, threads can write data to regular files and xterm processes could read them continuously like 'tail -f'...
We are limited just by our imagination... depending on the task to do, U can use shared memory, memory mapped files, message queues, database, indexed files, etc...
Well, I got it working.
We have to use the file descriptor returned by ptsname() for reading & writing.
and the xterm's -Sccn option holds good only when it is invoked from within a process with a system() call.