当前位置:网站首页>C language EXECL function
C language EXECL function
2022-07-01 03:08:00 【ma_ de_ hao_ mei_ le】
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
int main(int argc, char *argv[])
{
// execl function
// int execl(const char *pathname, const char *arg, ...
// pathname: The path of the file to execute ( Absolute path is recommended )
// The second parameter is a string , Is the parameter of the executable file specified in the first parameter ( It can be multiple parameters )
// The first parameter is the program name ( No dice )
// The second start is the parameters of the program
// The last parameter requires null end ( Used to inform execl End of parameter list —— sentry )
if (fork() > 0)
{
printf("I'm parent process: pid: %d\n", getpid());
sleep(1);
}
else
{
// Is currently a child process
// execl("/mnt/c/Users/x/Pictures/code/lesson14/2", "2", NULL);
execl("/bin/ps", "ps", "a", "u", "x", NULL);
printf("I'm child process: %d", getpid());
}
for (int i = 0; i < 3; i++)
{
printf("i=%d, pid: %d\n", i, getpid());
}
}
边栏推荐
- Mouse over effect I
- How to verify whether the contents of two files are the same
- Is it safe to open a stock account? Shanghai stock account opening procedures.
- Restcloud ETL data realizes incremental data synchronization through timestamp
- Mouse over effect 10
- [small program project development -- Jingdong Mall] the home page commodity floor of uni app
- 限流组件设计实战
- Redis tutorial
- Mouse over effect V
- Elk elegant management server log
猜你喜欢

【小程序项目开发-- 京东商城】uni-app之分类导航区域

【小程序项目开发-- 京东商城】uni-app之首页商品楼层

Const and the secret of pointers

UE4 rendering pipeline learning notes

第03章_用戶與權限管理

EtherCAT简介

EDLines: A real-time line segment detector with a false detection control翻译

Introduction and installation of Solr

Elk elegant management server log

【小程序项目开发 -- 京东商城】uni-app 商品分类页面(下)
随机推荐
LeetCode_栈_困难_227.基本计算器(不含乘除)
[applet project development -- Jingdong Mall] user defined search component of uni app (Part 1)
EtherCAT简介
So easy deploy program to server
UE4 rendering pipeline learning notes
Common interview questions for performance test
Huawei operator level router configuration example | BGP VPLS configuration example
Completely solve the lost connection to MySQL server at 'reading initial communication packet
Cloud native annual technology inventory is released! Ride the wind and waves at the right time
【机器学习】向量化计算 -- 机器学习路上必经路
Introduction to ieda right click source file menu
mybati sql 语句打印
[PR # 5 A] two way running (state pressure DP)
The best learning method in the world: Feynman learning method
Mouse over effect VI
Mouse over effect V
Mouse over effect II
安装VCenter6.7【VCSA6.7(vCenter Server Appliance 6.7) 】
HTB-Lame
Introduction and basic knowledge of machine learning