ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.