Re: fork ???



> Do anyone have a good example of how to use fork() ? What I am trying to
> do is to execute another program from my app ... I used system() before
> but it freezes up my app until the other program exits and do not
> continue running the gnome app widget after it ...  that was ok before
> but not anymore.I have read the man for it but I really don't get how to
> tell it what program to run ...

You probably don't want to do a full fork as it takes a lot of system
resources most of which you don't need.  Use a vfork and then have teh
child execute a execve system call.  The parent will suspend until you
issue the execve.

Caveats are that vfork doesn't make your code very portable from what I
glean from the linux kernel mailing list.

> So I am happy if anyone could share a peice of code that explains how to
> do this in a easy way !!! If you need more info please contact me

Um..hmm..lets see..you can probably find some good examples on the net for
this.  

I found this:

http://www.cs.bu.edu/faculty/gacs/cs410/lectures/06proc.txt


	sri





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]