Linux exec函数族的使用(二)

2014-11-24 10:56:01 ? 作者: ? 浏览: 2
*******
**
** execve.c--Illustrate the usage of execve
**
*****************************************************************************/

#include
#include
#include

int main( void )
{
char* args[] = { "/bin/ls", NULL };

if ( -1 == (execve("/bin/ls", args, NULL)) )
{
perror( "execve" );
exit( EXIT_FAILURE);
}

puts( "shouldn't get here" );
exit( EXIT_SUCCESS );
}

[root@localhost src]# gcc execve.c
[root@localhost src]# ./a.out
a.out child_fork.c execve.c fork.c getpid.c


-->

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: