delete the plt and data files after writing eps or png

(only if gnuplot_terminal is set to eps/quit of png/quit)
This commit is contained in:
Holger Vogt 2019-02-24 01:00:06 +01:00
parent 8efa08602a
commit 52584312c3
1 changed files with 23 additions and 1 deletions

View File

@ -16,7 +16,12 @@
#include "ngspice/dvec.h"
#include "ngspice/fteparse.h"
#include "gnuplot.h"
#if defined(__MINGW32__) || defined(_MSC_VER)
#undef BOOLEAN
#include <windows.h>
#else
#include <unistd.h.h>
#endif
#define GP_MAXVECTORS 64
@ -338,6 +343,23 @@ ft_gnuplot(double *xlims, double *ylims, char *filename, char *title, char *xlab
#endif
err = system(buf);
/* delete the plt and data files */
if ((terminal_type == 3) || (terminal_type == 5)) {
/* wait for gnuplot generating eps or png file */
#if defined(__MINGW32__) || defined(_MSC_VER)
Sleep(200);
#else
usleep(200000);
#endif
if (remove(filename_data)) {
fprintf(stderr, "Could not remove file %s\n", filename_data);
perror(NULL);
}
if (remove(filename_plt)) {
fprintf(stderr, "Could not remove file %s\n", filename_plt);
perror(NULL);
}
}
}