• Reference Guide


f <- open_program(folder, command, flags)
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 folder parameter (of the type String) specifies a folder in the context of which is the program executed. If no folder is specified (an empty string is used), the command is executed in the context of the folder in which Sfairadora is executed.
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.

Return Value

An l-value referring to the variable f is returned. If an error occurs, an Error value is returned.


Listing of the root folder of the disk C:
var File f;
f <- open_program("c:\", "cmd.exe /c dir", FILE_OPEN_READ|FILE_OPEN_WRITE);
var Text dir = read_text(f);

See Also