A: 

libc treats a pipe/file and a console connected to a (pseudo) terminal differently. In particular, the default buffering policy is different. See the extensive discussion in this Stack Overflow Q&A.

So, it's perfectly conceivable that a program which works when connected to a (pseudo) terminal won't work with a pipe. If you need more specific advice, you need to post (at least the skeleton of) your code.

Yuji