A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/python/os_mkfifo.htm below:

Python os.mkfifo() Method

Python os.mkfifo() Method

The Python method os.mkfifo() creates a FIFO named path with a numeric mode. The default mode is "0o666" (octal) which sets the read and write permissions for a given file..

The term FIFO stands for First In First Out. In Unix-like operating systems, it is a named pipe used for storing data in a temporary queue where the first data written into the pipe is the first to read out.

Syntax

Following is the syntax for Python os.mkfifo() method −

os.mkfifo(path, mode, * , dir_fd)
Parameters

The Python os.mkfifo() method accepts the following parameters −

Return Value

The Python os.mkfifo() method does not return any value.

Example

The following example shows the usage of mkfifo() method. Here, we are creating a FIFO named pipe "/tmp/new".

import os, sys

# Path to be created
path = "/tmp/new"

os.mkfifo( path )
print ("Path is created")

When we run the above program, it produces following result −

Path is created
Example

In the following example, we are creating a FIFO named pipe with the specified mode using mkfifo() method.

import os, sys

# Path to be created
path = "/home/tp/Python/nwdir/new"

os.mkfifo(path, 0o600)
print ("Path created with read and write permission")

When we run above program, it produces following result −

Path created with read and write permission

python_files_io.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4