python os.pipe() to create pipe and open the file descriptor in c

895 Views Asked by At

I want to use python to create a pipe readfd, writefd = os.pipe(). And then I create a subprocess inside my python script to run some c code where it tries to open the readfd(which is an int say 5) FILE* fp = fdopen(readfd, "r"); but it returns a nullptr. Why is this wrong? How can I open the file descriptor in my c code?

0

There are 0 best solutions below