Ronald Bultje wrote:

> For a simple application, I use the call:
> 
> system("a_command");
> 
> this runs this application. Now, this application needs some simple user
> input ("press enter to do this", etc). I tried creating a second thread to
> do this, but this will not press enter for this thread but for its own. So
> the a_command programm still thinks enter wasn't pressed.
> Can someone think of a way to give this user input without having to do it
> console by hand? (I mean, I try to make a GUI! :) )
> 

Don't use "system" to run the external program - use "popen" instead, 
which returns a set of pipes you can use in your main application to 
write to the child's stdin and read from its stdout.

If I recall correctly, the one caveat to this technique is that the 
child process won't work if it's got an X UI of its own - check the GTK+ 
FAQ for the complete scoop.

Regards,
Timothy M. Shead



_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to