Thanks Richard,

I don't think the output buffering does what I want. I want to be able to do
something like this:

        if( $preview_mode )
                $output = fopen("php://stdout", "w");
        else
                $output = fopen("/some/file/path/soemwhere.html", "w");
        
        GenerateOutput($output);


hmmm.... wait, maybe you're right. I guess I could grab the contents of the
output buffer and write it to the file instead of to stdout. Kind of an
indirect way of doing it. Not like C/C++.

Thanks for the pointer.
        
Richard Black wrote:
> 
> As far as I'm aware PHP does output to stdout. Whether or not we can
> actually access that stream is another question, and one I don't know the
> answer to.
> 
> However, I do have a suggestion... Have you looked at the output buffering
> functions? They seem to implement what you're trying to do...
> 
> http://www.php.net/manual/en/ref.outcontrol.php
> 
> HTH,
> 
> Richy
> 
> -----Original Message-----
> From:   Paul H. Breslin [SMTP:[EMAIL PROTECTED]]
> Sent:   21 December 2001 07:40
> To:     [EMAIL PROTECTED]
> Subject:        [PHP] Standard output (printf) question...
> 
> I'm trying to create a function that will generate output that could go to
> either a file or to the current browser directly. To do this I have
> something
> like:
> 
> function GenerateOutput($out)
> {
>         fwrite($out, "Some stuff");
>         fflush($out);
> }
> 
> and to call it I tried:
> 
>         $stdout = fopen("php://stdout", "w");
>         GenerateOutput($stdout);
> 
> But for some reason nothing shows in the browser when I do this.
> 
> I can't seem to find information about what output stream "printf" is
> actually
> writing to. Do we have access to this stream?
> 
> Can anyone provide a hint as to why the above doesn't work?
> 
> Thanks.
_________________________________________________________________________
Paul H. Breslin                                http://Canadian-Artist.com
mailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to