I want to start a prog from another prog but not as child
Hi, I need to know if theres a way to start a program from another program without using fork() the thing is i dont want that the new program apears like child of the first one, both programs execute in a console, and the program i want to start has no usr interface (it runs in background), I have already tryed this in my code but didnt work:
sprintf(eHab->cBuffIO, "./Persona %s %hd no", eHab->cIp, eHab->usPuerto); system(eHab->cBuffIO); ./Persona is the program, and eHab->cIp, eHab->usPuerto are the params Thanks, Damian. |
Use one of the exec(3) family of system calls. man 3 exec for details. Ask here again if you need clarification of what you've read.
|
In first place thanks for your help, I know about those functions, cant use them, sry I forgot to say that I need both programs working, the problem is that those functions remplace the program that calls it by the new prog thats being executed, the way to avoid that is using fork() but the new program will apear as a child, and I cant do that.
If you know about any other way to do it, or if thers no posible way, please tell me. Thanks again Damian. |
You must then fork() twice. The first fork starts a second fork and then the first one terminates, causing the process to be owned by init process.
|
Quote:
|
You could fork() the program, then call daemon(0,0).
After daemon(0,0) the program will not have any terminal to talk to anymore though. |
All times are GMT -5. The time now is 02:31 PM. |