hi
Why dont u try with the extra argument "type" in popen..
#include <stdio.h>
FILE popen(const char command, const char *mode);
If the mode is "r", "rt", or "rb", when the child process is started, its stdout is the writable end of the pipe, and the file descriptor of the returned stream is the readable end of the pipe.If the mode is "w", "wt", or "wb", when the child process is started, its stdin is the readable end of the pipe, and the file descriptor of the returned stream is the writable end of the pipe.
regards
smitha