Re: freopen?
- From: petersprc <petersprc@xxxxxxxxx>
- Date: Thu, 27 Sep 2007 17:11:31 -0000
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
.
- References:
- freopen?
- From: Per Jessen
- freopen?
- Prev by Date: Re: [PHP] PDOStatement execute memory issue?
- Next by Date: Conditional jump menu
- Previous by thread: freopen?
- Next by thread: problems with donwload
- Index(es):