VMS Help  —  CRTL  popen  Description
    The popen function creates a pipe between the calling program
    and a shell command awaiting execution. It returns a pointer to a
    FILE structure for the stream.

    The popen function uses the value of the DECC$PIPE_BUFFER_SIZE
    feature logical to set the buffer size of the mailbox it creates
    for the pipe. You can specify a DECC$PIPE_BUFFER_SIZE value of
    512 to 65024 bytes. If DECC$PIPE_BUFFER_SIZE is not specified,
    the default buffer size of 512 is used.

                                  NOTES

       o  When you use the popen function to invoke an output
          filter, beware of possible deadlock caused by output
          data remaining in the program buffer. You can avoid this
          by either using the setvbuf function to ensure that the
          output stream is unbuffered, or the fflush function to
          ensure that all buffered data is flushed before calling
          the pclose function.

       o  For added UNIX portability, you can use the following
          feature logicals to control the behavior of the C RTL
          pipe implementation:

          -  Define the DECC$STREAM_PIPE feature logical name to
             ENABLE to direct the pipe function to use stream I/O
             instead of record I/O.

          -  Define the DECC$POPEN_NO_CRLF_REC_ATTR feature logical
             to ENABLE to prevent CR/LF carriage control from being
             added to pipe records for pipes opened with the popen
             function. Be aware that enabling this feature might
             result in undesired behavior from other functions such
             as gets that rely on the carriage-return character.

    See also fflush, pclose, and setvbuf.
Close Help