ChinaUnix.net
相关文章推荐:

execlp

exec系列函数中 int execlp(const char *filename,char *const arg0,...(char *)0 ) arg0参数起什么作用 实际程序中 execlp("iptables","","-t","nat","-L",NULL) 和execlp("iptables","iptables","-t","nat","-L",NULL)的效果是一样的

by kingld - C/C++ - 2003-12-20 11:43:50 阅读(718) 回复(2)

相关讨论

请问: 1. 当发布一个execlp调用时,系统用什么值去生成一个系统进程表项? 2. 是否可以通过file argv引用此表项? 谢谢。

by cores - C/C++ - 2009-11-02 09:38:50 阅读(925) 回复(1)

#include #include #include #define Ports 3306 main() { struct sockaddr_in server; int socked,port; server.sin_family=AF_INET; server.sin_addr.s_addr=htonl(INADDR_ANY); server.sin_port = htons((short)Ports); socked=socket(AF_INET,SOCK_STREAM,0); port=bind(socked,(struct sockaddr *)&server,sizeof(server)); if (port==0) { execlp("mysql.server","m...

by 修理工 - C/C++ - 2007-12-15 09:33:52 阅读(1293) 回复(0)

#include #include #include #define Ports 3306 main() { struct sockaddr_in server; int socked,port; server.sin_family=AF_INET; server.sin_addr.s_addr=htonl(INADDR_ANY); server.sin_port = htons((short)Ports); socked=socket(AF_INET,SOCK_STREAM,0); port=bind(socked,(struct sockaddr *)&server,sizeof(server)); if (port==0) { execlp("mysql.server","m...

by 修理工 - C/C++ - 2007-12-14 01:47:10 阅读(1060) 回复(1)

#include #include #include #include int main(void) { pid_t childpid; childpid = fork(); if (childpid == -1) { perror("Failed to fork"); return 1; } if (childpid == 0) { /* child code */ execl("/bin/cat","/bin/cat","/etc/passwd","|","more", NULL); perror("Child failed to exec ls");...

by linuxcici - C/C++ - 2006-03-15 19:51:23 阅读(951) 回复(7)

在程序中调用execlp("/root/a","a","/b.bin",(char *)0);当这个函数执行完毕了如何让它再次执行?请赐教!谢谢!

by yueying - C/C++ - 2007-01-06 16:42:03 阅读(808) 回复(3)

#include #include #include #include #include #include #include #define MAXLINE 50 int main(void) { char buf[MAXLINE]; pid_t pid; int status,i; // char lsargv[] ={“ls”,”-l”, 0}; // char lsenvp[] ={“PATH=/bin:/usr/bin”, 0}; printf("Now it is before fork ...

by declare - C/C++ - 2006-07-19 10:01:08 阅读(943) 回复(4)

我用fork创建一个子进程,子进程用execlp()执行一个外部程序. 我的问题是:这个外部程序的父进程是调用 fork()的那个进程,还是init进程?

by xltao - C/C++ - 2005-12-23 10:54:23 阅读(3285) 回复(9)

在linux 进程程序中这样写道: while(proFlag=fork()); if(proFlag==0) switch(funFlag) { case 1:execlp("max",agv[0],agv[1],(char *)0);//max 是同目录下的一个可执行函数 case 2:printf("*******");break; default: } 编译运行,程序能保证funFlag==1,但结果打印****** 问题0:用execlp()不用添加当前max()所在路径的环境变量吗? 问题1:不是说execlp会将父进程中的代码断覆盖成自己的么?怎么还会执行后面的代码?...

by computerzanz - C/C++ - 2009-05-14 22:13:03 阅读(2716) 回复(9)

请问这几个函数具体是做什么用的? 谢谢

by mousexqshe - C/C++ - 2007-07-10 14:07:52 阅读(3336) 回复(17)

1 execlp的一个例子中写道: execlp("ls","ls","-a","/etc/",(char *)0); 请问这里面第二个参数是什么意思,作用是什么。 2 我最近看到一段代码,其中有一部份如下: if( (pid = fork())<0){ printf("fork error!\n"); exit(1); } else if (pid == 0){ execlp(buf,buf,(char *)0); printf("could't execute: %s",buf); exit(127); } if ( (pid = waitpid(pid,&sta...

by lynnix - C/C++ - 2005-05-20 14:05:18 阅读(1795) 回复(11)