Cactching Stdout

Gabriel Genellina gagsl-py at yahoo.com.ar
Wed Nov 8 20:15:41 CET 2006


At Wednesday 8/11/2006 06:09, Massi wrote:

>Hi everyone! I'm writing a python script which uses a C-written dll. I
>call the functions in the dll using ctypes, but I don't know how to
>catch the output of the "printf" which the C functions use. In fact I
>don't even know if it is possible! I've heard something about PIPE and
>popen...is this what I need? How can I use them? It is very important
>for me that I could take the output in real-time.

Since you are calling a function the same process, popen&co won't help.
This is just an idea; printf is writting to STDOUT; you could replace 
STDOUT with the write end of a pipe, and read from the other end.


-- 
Gabriel Genellina
Softlab SRL 

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



More information about the Python-list mailing list