C-Execute-Command

Steve Yelvington steve at thelake.UUCP
Mon Dec 4 06:55:26 AEST 1989


In article <1989Dec2.161237.23913 at virtech.uucp>,
     cpcahil at virtech.uucp (Conor P. Cahill) writes ... 

>In article <2615 at servax0.essex.ac.uk>, georg at SunLab13.essex.ac.uk	 (Georgatos G) writes:
>>             Does anybody know how to call an executable file from
>>                                a c-program ?
>>                       I am using the Unix-CC copiler.
>Look up the word execute in the permuted index for you programmers reference
>manual.  Therein you will find references to the exec(2) manual page.
>
>If you want to use the simplest interface (but much less efficient and 
>much more prone to security holes) you can use the system(3) library 
>call (which for some reason is in the index as "issue a shell command" 
>when it should be something like "execute commands using the shell" or 
>some such thing).
>
>All of the following will perform an "ls -l dir".  If you use one of the
>exec()s you need to use fork() and wait() to run the  program as a sub-process.
>

A couple of (probably stupid) questions:

1. On the net, I often see (non-code) references to functions with numbers
   inside the parens, as in system(3) and exec(2). None of the
   documentation I have uses these numbers. What do they mean, and where
   do they come from?

2. Can someone explain or (*explain) the differences between the spawn,
   exec and fork families of process-control functions? K&R 1, Harbison 
   & Steele, and the lesser reference works that I have are of no help
   on this issue. What does the new standard include?

   -- Steve Yelvington, up at the lake in Minnesota        
  ... pwcs.StPaul.GOV!stag!thelake!steve             (UUCP)   



More information about the Comp.lang.c mailing list