Hello, sorry to ask so many questions... I am trying to get plplot to rewrite 
the plot to the same file several times (part of my quest to write to a pipe 
into ffmpeg). In between plots (plbop().....pleop()) I delete the file 
(before I delete the file I send it into another ofstream that will pipe it 
into ffmpeg), and I expected plplot to recreate the file for the next plot so 
I can do it all over again. In the documentation is says that if using 
plbop(): "For a file driver, the output file is opened if necessary."

I'm now using the Debian Sid plplot, since I had segfault problems with the 
JPG-driver in the current SVN-version. I tried to reset the filename with 
plsfnam() between the plots, using the same string as when running it before 
plinit(), but then I get a segfault.

I have included a test program below. The part about piping the file into an 
ofstream is not in this test program, but that has nothing to do with the 
behaviour I'm discussing. I thought that a "1.jpg" would exist after the 
program exits, but that is not the case. The file only exists until I delete 
it in the program, it is not recreated at the next plbop():

Best regards,
Torquil Sørensen

#include <plplot/plplot.h>
#include <cstdio>

using namespace std;

int main(int argc, char *argv[]) {
    double x[] = { 0.1, 0.5, 0.2, 0.4, 0.4 };
    double y[] = { 0.5, 0.4, 0.4, 0.8, 0.9 };

    plparseopts(&argc, argv, PL_PARSE_FULL);
    plsfnam("1.jpg");
    plsdev("jpeg");
    plinit();
    plenv(0, 1, 0, 1, 1, -2);

    plbop();
    plbox("bcinst", 0, 0, "bcinst", 0, 0);
    plline(5, x, y);
    pleop();

    system("ls -l 1.jpg");
    remove("1.jpg");

    plbop();
    plbox("bcinst", 0, 0, "bcinst", 0, 0);
    plline(5, x, y);
    pleop();

    plend();

    return(0);
}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to