The popen procedure

Description

The popen procedure creates a process, opens a pipe (i.e. a communications channel) to the process, and associates a file variable with the pipe (i.e. opens the file variable). The popen procedure can open the file variable in read-only mode, write-only mode, or read/write mode.

Read-Only Mode

If the file variable is opened in read-only mode then the program can read the pipe and retrieve values written to the pipe by the process. However the program can not write values through the pipe for the process to read.

Write-Only Mode

If the file variable is opened in write-only mode then the program can write values to the pipe for the process to read. However the program can not read the pipe to retrieve values written to the pipe by the process.

Read/Write Mode

If the file variable is opened in read/write mode then the program can write values to the pipe for the process to read, and read the pipe to retrieve values written to the pipe by the process.

Parameter

  1. The first parameter is a reference to the file variable to be opened.
  2. The second parameter is an expression of string type or char type, and is the program from which the process is created.
  3. The third parameter is an expression of integral type which specifies the mode the file variable should be opened in. The file mode constants can be used to specify the mode. The readmode and writemode constants can be added or OR'd together to specify that the file variable be opened in read/write mode (i.e. for both reading and writing).

Portability

Operating Systems: All
Standard Pascal: No