当前位置:网站首页>Dup2 use
Dup2 use
2022-06-13 05:00:00 【Clown clown clown】
The header file :
Parameters :
dup2 It is a system call interface to help us redirect
Usage method : hold fd_arrays[oldfd] copy to fd_arrays[newfd], Implement redirection
principle :
To be able to use dup2, First understand the file descriptor fd
File descriptor
The following code does not call dup2 Interface , The essence is to point to the original stdout Of fd Points to the newly opened file .
Use dup2 It's written like this .
principle : Put the newly opened file fd copy to fd_arrays[1] Inside , Implement redirection .
Therefore use dup2 When ,
边栏推荐
- Embedded hardware: electronic components (1) resistance capacitance inductance
- Win8.1和Win10各自的优势
- C language learning log 10.8
- rainbow
- Four methods for judging JS data types and user-defined methods
- Analysis of the principle of V-model and its application in user defined components
- C language learning log 12.14
- Time display of the 12th Blue Bridge Cup
- Section 2 - branch and loop statements
- C language learning log 1.17
猜你喜欢

Explain the differences and usage scenarios between created and mounted

How to lay copper in AD (aluminum designer)

Luogu p1036 number selection

Configuration used by automatic teaching evaluation script

Mind mapping series - Database

Simple SR: best buddy Gans for highly detailed image super resolution

RMQ、LCA

What is the saturate operation in opencv

Explain the role of key attribute in V-for

About mission planning and improving execution
随机推荐
Several methods of identifying equivalent circuit of circuit drawing
What is the difference between ROM, ram and flash? SRAM、DRAM、PROM、EPROM、EEPROM
Advanced C - Section 2 - pointers
Luogu p1036 number selection
Sampo Lock
lookup
OJ problem solution summary
RuoYi-Cloud启动教程(手把手图文)
Chapter 13 abstraction: address space
About mission planning and improving execution
C language learning log 12.14
Win8.1和Win10各自的優勢
Chapter 14 introduction: memory operation API
Opencv image storage and reading
Chapter 2 process management
Kaggle 时间序列教程
CMB's written test -- data analysis
C language learning log 11.7
Draw a hammer
Sort (internal sort) + external sort