[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://csruizhi.cn/article/ihehig.html

其他资讯

Copyright © 2007-2024 成都优众联杰科技有限公司 All Rights Reserved 蜀ICP备2024116266号
友情链接: 重庆企业网站建设 重庆手机网站建设 定制网站设计 响应式网站设计方案 高端网站设计 成都定制网站建设 成都网站建设公司 营销型网站建设 成都网站建设 成都网站设计公司 成都网站制作 网站建设方案 重庆网站建设 成都网站建设 四川成都网站设计 成都网站建设 成都企业网站制作 上市集团网站建设 成都网站建设 成都网站建设 成都网站设计 网站制作