Article View: comp.std.c
Article #4508Re: Simple PID = System() ?
From: Christopher R. Volpe
Date: Wed, 20 Dec 1995 14:43
Date: Wed, 20 Dec 1995 14:43
23 lines
1431 bytes
1431 bytes
In article <4b7p8u$gbv@newshound.csrv.uidaho.edu>, garc9588@harrier.csrv.uidaho.edu (Laura Garcia) writes:
|> Hi,
|> I have a very simple Question.
|>
|> How do I get the PID of my child-process after calling
|> the "system("child-process");" function?
|>
|> I really do not want to launch another system call just to "PS" around.
|>
|> M&L
There's no such thing as a PID in ANSI C, so you're stuck with a non-ANSI
solution. Use fork() to start the subprocess, which will give the parent the
PID of the child. In the child you can exec a shell with the appropriate
arguments to do the command you wanted to do.
Followups to comp.unix.programmer.
--
Chris Volpe Phone: (518) 387-7766 (Dial Comm 8*833
GE Corporate R&D Fax: (518) 387-6560
PO Box 8, Schenectady, NY 12301 Email: volpecr@crd.ge.com
Technical Details
Message-ID:
<4b97fa$lj0@rdsunx.crd.ge.com>Path:
arc1-ca.pugleaf.net!bart.crd.ge.com!volpeReferences:
<4b7p8u$gbv@newshound.csrv.uidaho.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe From: volpe@bart.crd.ge.com (Christopher R. Volpe) Newsgroups: comp.std.c,comp.unix.programmer Subject: Re: Simple PID = System() ? Followup-To: comp.unix.programmer Date: 20 Dec 1995 14:43:54 GMT Organization: GE Corporate Research & Development Sender: volpe@bart (Christopher R. Volpe) Distribution: world Message-ID: <4b97fa$lj0@rdsunx.crd.ge.com> References: <4b7p8u$gbv@newshound.csrv.uidaho.edu> Reply-To: volpe@ausable.crd.ge.com NNTP-Posting-Host: bart.crd.ge.com