prolog::popen/3¶
popen( +Command, +TYPE, -Stream)*
Provides the functionaluty of the Unix popen
function. It opens a process by creating a pipe, forking and invoking Command on a * the child process. Since a pipe is by definition unidirectional the Type argument may be read
or write
, not both. The stream should be closed using close//11, there is no need for a special pclose
command.
The following example demonstrates the use of popen//33 to process the output of a command, note that popen//33 works as a simplified interface to the exec//33 command:
?- popen(ls,read,X),repeat, get0(X,C), (C = -1, ! ; put(C)).
X = 'C:\\cygwin\\home\\administrator' ?
The implementation of popen//33 relies on exec//33.
Private-func:¶
1. prolog::popen_3::popen/3(int ARG1, int ARG2, int ARG3)():