开发者

execve in unix systems

#include<unistd.h>

int main(int argc, char **argv)
{
 开发者_高级运维int ret;

 ret = execve("/bin/bash", NULL, NULL);

 return 0;

}

i m confuse about why the null values are passsed in execve please help.....


Those parameters correspond to the program's arguments and environment. By passing NULL in for both, the caller is indicating that no arguments should be supplied to the program and no environment variables should be supplied either.


this code opens new shell..... like when you execute any command the shell copies itself and executes the command.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜