Linux application development-famous pipeline programming

Source: Internet
Author: User
Tags function prototype

Linux application Development-famous pipeline programming A famous pipe

For any two process communication, known as a pipeline called FIFO file, so we

The operation of the Tao can take the method of manipulating files, such as using Open,read,write.

2 Features

FIFO files have similarities to normal files in use, but there are differences:

1. Processes that read FIFO files can only open FIFO files in "rdonly" mode.

2. The process of writing FIFO file can only open FIFO in "wronly" mode

3. When the contents of the FIFO file are read, it disappears. However, the contents of the normal file are still available after reading.

3 Correlation functions

Create a named pipe

Name of function

Mkfifo

Function prototype

int Mkfifo (const char *pathname, mode_t mode)

function function

Create a FIFO file or a well-known pipeline

Owning header file

#include <sys/types.h>

#include <sys/stat.h>

return value

Successful return 0

Failed return-1

Parameter description

Pathname: The name of the FIFO file to be created with the path of the

Mode: access rights to the FIFO file created






Remove a named pipe

Name of function

Unlink

Function prototype

int unlink (const char *pathname)

function function

deleting files including FIFO files

Owning header file

#include <unistd.h>

return value

Successful return 0

Failed return-1

Parameter description

Pathname is the name of the file that contains the path


a small case



Blocking State

unblocked.

Linux application development-famous pipeline programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.