On 09/10/2010 10:01 AM, Shai Ayal wrote:
This part is written using C io anyway.
What happens in C if you close a file descriptor opened by popen?
Shai
Here is all I know (from
man popen):
The return value from popen() is a normal standard I/O
stream in all respects save
that it must be closed with pclose() rather than
fclose(3). Writing to such a
stream writes to the standard input of the command; the
command’s standard output
is the same as that of the process that called popen(),
unless this is altered by
the command itself. Conversely, reading from a "popened"
stream reads the com-
mand’s standard output, and the command’s standard input is
the same as that of the
process that called popen().
Note that output popen() streams are fully buffered by
default.
================================================
I would definitely use pclose().
Michael