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");
                $output = fopen("/some/file/path/soemwhere.html", "w");

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...
> HTH,
> Richy
> -----Original Message-----
> From:   Paul H. Breslin [SMTP:[EMAIL PROTECTED]]
> Sent:   21 December 2001 07:40
> 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                      

PHP General Mailing List (
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