|
楼主 |
发表于 2004-5-8 17:29:56
|
显示全部楼层
<>函数名: exec...
功 能: 装入并运行其它程序的函数
用 法: int execl(char *pathname, char *arg0, arg1, ..., argn, NULL);
int execle(char *pathname, char *arg0, arg1, ..., argn, NULL,
char *envp[]);
int execlp(char *pathname, char *arg0, arg1, .., NULL);
int execple(char *pathname, char *arg0, arg1, ..., NULL,
char *envp[]);
int execv(char *pathname, char *argv[]);
int execve(char *pathname, char *argv[], char *envp[]);
int execvp(char *pathname, char *argv[]);
int execvpe(char *pathname, char *argv[], char *envp[]);
程序例: <>/* execv example */
#include <process.h>
#include <stdio.h>
#include <errno.h> <>void main(int argc, char *argv[])
{
int i; <P> printf("Command line arguments:\n");
for (i=0; i<argc; i++)
printf("[%2d] : %s\n", i, argv); <P> printf("About to exec child with arg1 arg2 ...\n");
execv("CHILD.EXE", argv); <P> perror("exec error"); <P> exit(1);
}
</P> |
|