In article <11*********************@g47g2000cwa.googlegroups. com>,
<fr********@yahoo.com.cn> wrote:
The only mechanism portable C has to run another program is
the system() library call.
1 #include <sys/types.h>
2 #include <sys/times.h>
3 int
4 main(int argc,char* argv[])
5 {
6 struct tms before, after;
7
8 times(&before);
9
10 pid_t pid;
11 if((pid=fork())<0)
12 printf("fork() error\n");
13 else if(pid==0){
14 if(execv("%s",argv[1],&argv[2])<0)
15 printf("error occurs when exec the
file\n");
16 }
17
18 times(&after);
fork() and kin are off-topic in comp.lang.c -- try comp.unix.programmer .
hint: read the manual page for wait()
--
"I will speculate that [...] applications [...] could actually see a
performance boost for most users by going dual-core [...] because it
is running the adware and spyware that [...] are otherwise slowing
down the single CPU that user has today" -- Herb Sutter