1. Famous pipeline: Also known as FIFO file.
2.man commands: 1. System commands, 2. System calls, 3 library functions
3. Function Learning
5.2 Create a named pipe
5.2. 1 Name of function
Mkfifo
5.2.2 Function prototype
int Mkfifo (const char *pathname, mode_t mode);
5.2.3 function function
Create a FIFO file (named pipe)
5.2.4 Owning header file
<sys/types.h>
<sys/stat.h>
5.2.5 return value
Success: 0
failed: -1
5.2.6 Parameter Description
Pathname: Name of the FIFO file to be created (with path)
Mode: Access, digital form means yes (0666)
5.3 Remove a named pipe5.3. 1 Name of function
Unlink5.3.2 Function prototype
int unlink (const char *pathname);5.3.3 function function
Deleting Files5.3.4 Owning header file
<unistd.h>5.3.5 return value
Success: 0failed: -1
5.3.6 Parameter DescriptionPathname: Used to indicate the name of the file to be deleted (with path)
the difference between 4.FIFO files and ordinary files
(1) write only when the write is open(2) Read-only open
(3) content no longer exists after reading
Other operations are done with ordinary files. 5. General Examples
(1) Write file process---"Create FIFO
---"Open and write---"Closed
(2) Read the file process---"Reading the file
---"Print---"Closed
---Delete a named pipe
6. If there is no read process access FIFO, the write process is blocked until a process accesses the FIFO to end the write process.
12th Lesson-Famous pipe communication