Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2003022

Re: [PHP] Redirecting STDOUT to a file pointer From: Jeff Bearer (jbearer <email protected>)
Date: 02/28/03

Argh, I was thinking about the problem backwards, redirect the fp to stdout
is the way to do it.

if(!$argv[1]) $argv[1] = "php://stdout";
$fp = fopen($argv[1], "w");
fputs($fp,"blah\n");
fclose($fp);

On Fri, 2003-02-28 at 15:11, Jeff Bearer wrote:
> I'm working on a shell script in php. The script has an option to write
> to standard output, or to a file. If the filehandle is opened I'd like
> to redirect standard output to the file pointer. This would allow me
> not to have to handle every output statement twice, once with an echo
> and again with an fputs.
>
> Can this be done in PHP?
>
>
> --
> Jeff Bearer, RHCE
> Webmaster, PittsburghLIVE.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
Jeff Bearer, RHCE
Webmaster, PittsburghLIVE.com

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php