How to get 2 text windows with a single program
Hi,
Running Ubuntu and writing simple C programs. I need 2 text windows, the one I have started in, and a second to display some debug information. I can start a second screen using popen("/usr/X11R6/bin/xterm" "w"), and I get my new text window. However, it is running a shell and I can't send any info to it! Is there a better way to do this? Thanks for any help you can give me. Regards, Chris. |
Are you talking about doing this FROM your C program, or while you are editing code?
If it is while your are editing code, have you taken a look at the EMACS editor? It is specifically designed to have code in one text window, and GDB output / interface in another. |
Part of my own program, NOT part of the editing process.
When running a program in the console you can output text etc. What I want is to open a second text window, with the functionality of xterm, that is I want it to recognise the ESC codes etc, so that I can output some debug info / status screens whilst still typing and getting messages in the original screen. Chris. |
I think you need to understand the difference between opening a window (what you want), and launching a program (what you're doing). To open a window (assuming using X), you must use X toolkit functions and primitives, and explicitly write text strings to the window. There may be more streamlined ways of doing this by using one of the desktop libraries/toolkits such as GTK (Gnome) or Qt (KDE). I'm not very familiar with any of these libraries; maybe someone who is can fill in more of the details.
--- rod. |
Solved: How to get 2 text windows
I have a resonable solution to the problem:
I can start a new xterm with say popen(); Then if I do 'who' I can see the new terminal name such as /dev/pts/1 I then do term = fopen("/dev/pts/1", "w"); fprintf(term,"This is some text"); and it comes up in my new window, including using ESC commands to clear the screen etc. I need to automatically scan the result of 'who' but thats a minor problem. Thanks for peoples help. Chris. |
All times are GMT -5. The time now is 08:17 AM. |