in reply to Redirect STDOUT to textfile?

If the shell redirection method isn't suitable (eg, running in a CGI script, or envoked in some other way you can't control), there are other options.