Re: XForms: fl_exe_command,fl_popen

From: Yann Guichoux (guichoux@shom.fr)
Date: Wed Mar 22 2000 - 10:22:32 EST

  • Next message: Steve Lamont: "Re: XForms: fl_exe_command,fl_popen"

    # To subscribers of the xforms list from Yann Guichoux <guichoux@shom.fr> :

    Steve Lamont wrote:
    >
    > # To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :
    >
    > > I think i got a bug with fl_popen & fl_pclose functions.
    > >
    > > I spawn a process using popen ...
    > > I write to it some data
    > > I close the process using pclose
    > >
    > > Everything works fine...
    > >
    > > When i use fl_popen & fl_pclose instead of popen &pclose...the child
    > > process jams...
    >
    > I noticed something similar when playing with it myself. There are a
    > couple of things I don't understand in the source as of this moment
    > in fl_pclose().
    >
    > If you can provide some simple example code, that would be helpful.
    >
    > spl

    here are the only things i do :

    ...
    sprintf(s_buffer,"%s/bin/mpeg_encode -realquiet
    %s",GAIAHOME,_paramFile);
    _pw=fl_popen(s_buffer,"w");

    for (i=0; i<10 ; i++)
    {
            writePPM(fl_image[i],_pw);
    }

    fl_pclose(_pw);
    ...............

    with this "writeFunction"

    void writePPM(FL_IMAGE *fl_image,FILE *fpointer)
    {

            register int y, x;
            unsigned char r,g,b;

                /* magic number */
                fprintf(fpointer, "P6\n");

                /* width, height */
                fprintf(fpointer, "%d %d\n", fl_image->w, fl_image->h);

                /* max value */
                fprintf(fpointer, "255\n");

                for ( y = 0; y < fl_image->h; y++ )
            {
                    for ( x = 0; x < fl_image->w; x++ )
                    {
                            r=(unsigned char)fl_image->red_lut[fl_image->ci[y][x]];
                            g=(unsigned char)fl_image->green_lut[fl_image->ci[y][x]];
                            b=(unsigned char)fl_image->blue_lut[fl_image->ci[y][x]];

                                fwrite(&r, 1, 1, fpointer);
                                fwrite(&g, 1, 1, fpointer);
                               fwrite(&b, 1, 1, fpointer);
                    }
            }
    }
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/



    This archive was generated by hypermail 2b29 : Wed Mar 22 2000 - 10:26:46 EST