tags:

views:

90

answers:

2

Hi,

I have a main program written in C, i need it to launch another process in parallel, I used the function

system("./server");

the problem is that this process contains a while(1) loop so it never return to the main application...

Is there a way i can launch the program without having to do a fork()?

thanks!

+3  A: 

Sure - just do this:

system("./server &");
Paul R
+5  A: 

In UNIX/Linux fork() (usually folowed by exec()) is the only way to create a new process.

All other ways (system(), some OSes have spawn()) really use fork().

So fork() is just unavoidable (for UNIX/Linux).

qrdl