028-86922220

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

[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.tsicrk.com/article/ihehig.html

其他资讯

让你的专属顾问为你服务

1.4279s