> I think that would create an unacceptable performance penalty for the child > process.
The child process would not be affected at all! FILE* will be unbuffered only in your application, yet "cat" will read from a file descriptor "1" (and may or may not apply any buffering on top of it, such as FILE*, on its own). Since you are going to read only a few bytes out of "f" and leave the rest to "cat" (per your example), there is no performance penalty; in fact there will be some gain not to pre-fill a buffer for "f" (which you don't need anyways). Also, you can just use basic unix IO (read() vs. fread()), and call lseek(1,0,SEEK_SET) prior to popen(). This way, there's no user-level buffering and file position is consistent with your actions and expectations. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple