The parameter
f
is a
variable
of the type
File
. The function runs
a program specified by the
command
parameter (of the type
String
) and
redirects its standard input and/or output to the file
f
.
The parameter
flags
is a combination
of the
file
opening and creation constants. Of which only the values
FILE_OPEN_READ
and
FILE_OPEN_WRITE
can be used. If
FILE_OPEN_READ
is specified, the standard
output of the program is redirected. If
FILE_OPEN_WRITE
is specified, the standard input of the program is redirected.
An
l-value
referring to the variable
f
is returned.
If an error occurs, an
Error
value is returned.
f <- open_program("c:\", "cmd.exe /c dir", FILE_OPEN_READ|FILE_OPEN_WRITE);