octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wait_for_file ?? [who/what/where does fclose()?]


From: Michael D Godfrey
Subject: Re: wait_for_file ?? [who/what/where does fclose()?]
Date: Fri, 10 Sep 2010 10:21:35 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Thunderbird/3.1.3

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]