Article View: comp.unix.programmer
Article #5Re: Creating a background process from within C prog
From: Jeff Murphy
Date: Tue, 27 Oct 1992 22:55
Date: Tue, 27 Oct 1992 22:55
32 lines
1259 bytes
1259 bytes
You might try something like this:
-----
#include <stdio.h>
main()
{
int kiddo;
printf("hello\n");
kiddo = fork();
if (kiddo == 0)
{
system("ls > /tmp/myfile");
exit(0);
}
printf("world\n");
}
-----
this just forks a child process which then runs the process
using a system() call. it doesn't check to make sure that the fork() was
successful. just make sure that the system() process doesnt try to grab the
terminal while the parent is using it.
smurfo
--
jcmurphy@acsu.buffalo.edu cit network installation & repair
opnsmurf@ubvms.cc.buffalo.edu sunyab
Technical Details
Message-ID:
<BwsyCt.9Gx@acsu.buffalo.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!darwin.sura.net!jvnc.net!yale.edu!think.com!ames!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!dsinc!ub!acsu.buffalo.edu!jcmurphyReferences:
<1992Oct27.103059.60148@cc.usu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!darwin.sura.net!jvnc.net!yale.edu!think.com!ames!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!dsinc!ub!acsu.buffalo.edu!jcmurphy From: jcmurphy@acsu.buffalo.edu (Jeff Murphy) Newsgroups: comp.unix.programmer Subject: Re: Creating a background process from within C prog Message-ID: <BwsyCt.9Gx@acsu.buffalo.edu> Date: 27 Oct 92 22:55:41 GMT References: <1992Oct27.103059.60148@cc.usu.edu> Sender: nntp@acsu.buffalo.edu Organization: UB Lines: 32 Nntp-Posting-Host: vodalus.acsu.buffalo.edu