Initializing help system before first use

openpipe

openpipe


Purpose
Start an external process for bidirectional communication.
Synopsis
procedure openpipe(cmd:string|text)
Argument
cmd 
The command to be executed in the separate process
Example
The following example uses an external program sort (we assume it writes a sorted copy of what it reads) to display a sorted list of the content of set ToSort:
openpipe("sort")
forall(i in ToSort)
 writeln(i)
fclose(F_OUTPUT)

while(not iseof) do
 readln(l)
 writeln(l)
end-do
fclose(F_INPUT)
Further information
1. Pipes required by this procedure are created using the pipe driver of this module (see Section Driver pipe). As a consequence, the string provided as argument must be suitable for the driver ( i.e. a program name followed by its options separated by spaces).
2. This procedure opens both an input and output streams that must be closed explicitly using fclose. Note that the output stream must be closed first otherwise the program may lock up.
3. When Mosel is running in restricted mode (see Section mosel command: restricted mode), this procedure behaves like the system procedure.
Module