470,638 Members | 1,577 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,638 developers. It's quick & easy.

Problems redirecting STDOUT (NOT sys.stdout) to a pipe.

Hello All,

I am trying to capture some printf's from a C function called by
python.
<Working under winxp>

I have tried to following:

STDOUT = 1 # stdout fd
(re, we) = os.pipe() # Create re / write handlers
dup2(we, STDOUT) # override system's stdout, should dup first and
restore later..

call_my_hello_world() # if stdout is not overriden will print hello
world on console screen

x = os.read(re, 11)

sadly, x = '' after the code is executed.

help ? :-)

Thanks,

Elad.

Mar 19 '06 #1
0 1440

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by David Douard | last post: by
1 post views Thread by Kocica | last post: by
2 posts views Thread by goodnamesalltaken | last post: by
8 posts views Thread by Morpheus | last post: by
1 post views Thread by loial | last post: by
3 posts views Thread by Jesse | last post: by
1 post views Thread by =?ISO-8859-1?Q?Richard_Sim=F5es?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.