Subject: Pipes in Fortran

From: "G. Ravishanker" <[email-masked]>
Date: Wed, 14 Feb 1996 16:20:21 -0500

Hi All

        I would like to use pipes in Fortran. Basically, in my C programs, I
open a pipe using popen and it returns a file handle, with which I can do
whatever I do with a file, such as writing a sequence of commands one after
the other. I want to do the same thing in fortran. popen works for a single
command, but I do not know how to access it after that. If I do

        iunit = popen ("/usr/local/bin/wg ")    !open wg program        

        write (iunit,*)'Graph'                  ! I want to ask wg to draw a
graph

iunit is always zero and the subsequent write has no meaning. However,

main ()
{
        FILE *iunit;

        iunit = popen("/usr/local/bin/wg", "w");
        fprintf(iunit,"Graph\n");
        fprintf(iunit,"Curve 1 2\n");
        fprintf(iunit,"Table\n");
        ......
        fclose(iunit);
}

works fine.

        Any help is appreciated.

Ravi