澄梦希喜广告网站制作遂宁站

[Linux进程]使用execl函数调用date命令

#include 
#include 
#include 
int main(int argc,char *argv[])
{
  pid_t pid;   //进程标识符
  printf("**This is a test for exec series fun**\n"); //打印提示符
  if(fork()==0)  //创建一个子进程
  {
    execl("/bin/date","/bin/date",(char*)0);  //使用execl函数调用date命令
    exit(0);  //退出
  }
  else
 {
   sleep(1);  //主进程休眠
   execl("/bin/time","/bin/time",(char*)0);
 }
  exit(0);
}

当前标题:[Linux进程]使用execl函数调用date命令
文章起源:http://www.hfanp.com/article/ihehig.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部