Re: freopen?



Hi.

PHP does not have an freopen command. You could accomplish this using
proc_open:

<?

// Specify that stdin should be read from a file:

$spec = array(
0 => array('file', '/tmp/file', 'r')
);

$proc = proc_open('cat', $spec, $pipes);
if (!is_resource($proc)) {
throw(new Exception('Failed to execute cat.'));
}
$ec = proc_close($proc);
echo "Command exited with code $ec.\n";

?>

On Sep 27, 4:50 am, p...@xxxxxxxxxxxx (Per Jessen) wrote:
Is there no freopen function in php?

I need to redirect stdin to a filename - outside of a shell so I can't
use a plain < redirect).

/Per Jessen, Zürich


.