Starting with the python2.4 version, you can use the Subprocess module to generate child processes and connect to the child process's standard input/output/error, as well as to get the return value of the child process.Subprocess is intended to
s under Linux we should try to avoid using system. Now let's look at a simple introduction to the system () function under Linux:
#include
int system (Const char* command)
The system () function calls/bin/sh to execute the specified command of a
36.16.commands-utilities for runningcommandsDeprecated since version 2.6:the commands module has been removed in Python 3. Use the subprocess module instead.The commands module contains wrapper functions for Os.popen () which take a system command
13.3.2 How to implement Popenwhen you request the Popen call to run a program, it first starts the shell, the SH command in the system, and then passes the command string to it as a parameter, this has two effects, one good, one bad.In Linux, all
The standard I/O function library provides a popen function that initiates another process to execute a shell command line.
Here we call the process called Popen the parent process, and the process initiated by Popen is called a subprocess.
The
using the system under Linux requires caution , so what is the alternative?The standard I/O function library provides the Popen function, which initiates another process to execute a shell command line.Here we call the process calling Popen the
using the system under Linux requires caution, then what is the alternative to it? The standard I/O function library provides the Popen function, which initiates another process to execute a shell command line.Here we call the process calling Popen
The standard I/O function library provides the Popen function, which initiates another process to execute a shell command line.Here we call the process calling Popen the parent process, and the process initiated by Popen is called a child
header Files : #include Function Description:FILE * Popen (const char * command, const char * type); int pclose (file * stream);Description: (Refer to Advanced Programming for UNIX environments)the Popen () function creates a child process by
Linux C-popen () function
# Include
File * popen (const char * command, const char * type );
Int pclose (File * stream );
Description
The popen () function uses the pipeline creation method and shell. because the pipeline is defined as a single
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.