⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 po

📁 Algorithms for Image Processing and Computer Vision Source Code
💻
字号:
@c ----------------------------------------------------------------------
@node popen, unix
@heading @code{popen}
@subheading Syntax

@example
#include <stdio.h>

FILE *popen(const char *program, const char *mode);
@end example

@subheading Description

This function executes the named @code{program} and attaches either it's
input stream or it's output stream to the returned file.  While the file
is open, the calling program can write to the program (if the program
was open for writing) or read the program's output (if the program was
opened for reading).  When the program is done, or if you have no more
input for it, pass the file pointer to @code{pclose} (@pxref{pclose}),
which terminates the program. 

Since MS-DOS does not support multitasking, this function actually runs
the entire program when the program is opened for reading, and stores
the output in a temporary file.  @code{pclose} then removes that file. 
Similarly, when you open a program for writing, a temp file holds the
data and @code{pclose} runs the entire program.

The @var{mode} is the same as for @code{fopen} (@pxref{fopen}). 

@subheading Return Value

An open file which can be used to read the program's output or write to
the program's input. 

@subheading Example

@example
FILE *p = popen("dir", "r");
read_program(p);
pclose(p);
@end example

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -