Re: external program;Somebody else with running problems
- From: Sergiu Gavrila <sergiu deuroconsult ro>
- To: gtk-list redhat com
- Subject: Re: external program;Somebody else with running problems
- Date: Fri, 26 Feb 1999 11:09:45 +0200
I try to run a program from a Gtk1.0.2 application (using fork, exec,...) when
I press a button, but I am doing something wrong because I get an error (Xlib
asynchronous replay, then core dump). I don't think is something with the Gtk
(maybe with my lack of X programing knowledge), but if someone has a solution,
please help. The function I am using to launch a program is bellow:
void launch(char *line)
{
pid_t pid;
switch (pid=vfork()){
case -1:
g_print("Fork error!");
break;
case 0:
execl(line,line,NULL);
exit(0);
break;
default:
g_print("GrandPa");
}
}
Havoc Pennington wrote:
> On Fri, 26 Feb 1999, Low Yoke Hean wrote:
> >
> > static void run(GtkWidget *widget, gpointer data){
> >
> > pop a modal dialog box
> > execute an external program
>
> I assume you're waiting for the external program to finish running?
> If you do that, there's no way for Gtk to run, so it can't update the
> display.
>
> If you don't care about the output of the external program, just fork(),
> exec(), and forget it. (Gnome has some convenience functions to do this if
> you use Gnome.)
>
> If you do care about the output and you're reading it via pipes or
> something, use gtk_input_add() to install a handler function to
> be called whenever there is data on the pipe. Or alternatively, install a
> timeout function and periodically read from the pipe.
>
> Havoc
>
> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]