1
我有一個管道gnuplot,我用它來繪製文件。該文件得到很好的圖形,並在屏幕上生成,但是當我試圖管set terminal jpeg
和set output file.jpeg
我在屏幕上得到垃圾。有沒有其他人有同樣的問題。這裏是代碼:管道設置終端到gnuplot管道在屏幕上產生垃圾
FILE *gnuplotPipe = popen("gnuplot -persist","w");
fprintf(gnuplotPipe, "set terminal jpeg\n"); //without these two lines it works
fprintf(gnuplotPipe, "set output %s.jpeg\n ",fileName);
int i = 2;
if (gnuplotPipe)
{
fprintf(gnuplotPipe, "plot ");
....//plot some stuff,it is tested works.
}
fprintf(gnuplotPipe, "\n");
fflush(gnuplotPipe);
fprintf(gnuplotPipe,"exit \n");
pclose(gnuplotPipe);
}
我也嘗試刷新兩個命令後,但沒有結果。