当前位置:网站首页>system()
system()
2022-06-12 19:35:00 【Lee Neo】
system相当于fork+exec+wait的简单封装;
system初体验:
#include <stdio.h>
#include <stdlib.h>
int main()
{
system("date > /tmp/out");
exit(0);
}
system的实现过程:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
int main()
{
pid_t pid;
pid = fork();
if(pid < 0)
{
perror("fork()");
exit(1);
}
if(pid == 0)
{
execl("/bin/sh", "sh", "-c", "date", NULL);
perror("execl()");
exit(1);
}
wait(NULL);
exit(0);
}
边栏推荐
- Software usage of Tencent cloud TDP virt viewer win client
- 5G R17标准冻结,主要讲了些啥?
- Blue Bridge Cup basic-14 VIP question time conversion
- Research Report on the overall scale, major manufacturers, major regions, products and application segments of lifeboats in the global market in 2022
- no available service ‘null‘ found, please make sure registry config correct
- 基于微信电子书阅读小程序毕业设计毕设作品(8)毕业设计论文模板
- China's asset management market demand and future competitive trends outlook report 2022-2028
- 运算器的基本结构
- [5gc] Introduction to three SSC (session and service continuity) modes
- Original introduction to Jenkins' configuration options
猜你喜欢

运算器的基本结构

Php+flash large file breakpoint continuation function sharing

Pyinstaller packaging tutorial packaging resource files

"As a service", the future has come, starting from the present | new mode of it consumption, FOD billing on demand
![[blockbuster release] ant dynamic card, enabling the app home page to realize agile update](/img/a6/62caef27b917bbb4c5529de46bc7f9.jpg)
[blockbuster release] ant dynamic card, enabling the app home page to realize agile update

YOLOX网络结构详解

5G R17标准冻结,主要讲了些啥?

7:00 tonight | application of PhD debate self supervised learning in Recommendation System

Attack and defense world (WEB) -- supersqli

RT-Thread 模拟器 simulator 搭建 LVGL 的开发调试环境
随机推荐
Embedded development: 6 necessary skills for firmware engineers
Wangxuegang room+paging3
基于FPGA的VGA协议实现
Shell arrays and functions
RT thread simulator builds lvgl development and debugging environment
IO流基础知识详解--文件及IO流原理
Rhca memoirs -- Introduction to cl280
腾讯云TDP-virt-viewer win客户端的软件使用
Market development planning and investment prospect analysis report of Chinese government investment and financing platform 2022-2027
China's asset management market demand and future competitive trends outlook report 2022-2028
In 2021, the global fire pump drive power revenue is about $381million, and it is expected to reach $489.3 million in 2028
[notes for question brushing] line segment tree
[image denoising] image denoising based on regularization with matlab code
【图像去噪】基于正则化实现图像去噪附matlab代码
Can't understand kotlin source code? Starting with the contracts function~
Super heavy! Apache Hudi multimode index optimizes queries up to 30 times
The 14th five year development plan and investment prospect analysis report of China's oil and gas pipeline engineering construction 2022-2027
Storage system overview
设备管理-借还模块1
Module 8 operation