[mod_python] Output from C functions

Gregory Trubetskoy grisha at modpython.org
Sun Oct 29 21:12:49 EST 2000

On Mon, 30 Oct 2000, Alexis Iglauer wrote:

> I'm doing this from inside a cgi script, would that make the solution any
> easier?  Seems like a mightily complex way to do a printf :)  

Actually, the CGI "printf" results into something that is indeed fairly
complex - there is at least three layers of networking protocols
underneath it.

> I would like to stay entirely inside C for my loop, for speed
> purposes.  Can I maybe pass the file handle of stdout to my function
> and then write to that?

Well, not really. That stdout is not a C file handle, nor does it contain
a reference to one. It's a Python object that implements the Python file
interface, that's all.

I think your problem is thinking in terms of CGI. If you are after speed,
then CGI is hardly the answer anyway. If I were you, I would start getting
confortable with the idea of abandoning the cute CGI printf way of
outputting things. ;-)



More information about the Mod_python mailing list