C Module question
Floris Bruynooghe
floris.bruynooghe at gmail.com
Mon Nov 10 08:18:05 EST 2008
Hi
On Nov 10, 11:11 am, "boblat... at googlemail.com"
<boblat... at googlemail.com> wrote:
> 1. How can I pass a file-like object into the C part? The PyArg_*
> functions can convert objects to all sort of types, but not FILE*.
Parse it as a generic PyObject object (format string of "O" in
PyArg_*), check the type and cast it. Or use "O!" as format string
and the typechecking can be done for you, only thing left is casting
it.
See http://docs.python.org/c-api/arg.html and http://docs.python.org/c-api/file.html
for exact details.
(2 is answered already...)
Regards
Floris
More information about the Python-list
mailing list