I want to print some data in a c++ application that I am doing using gnuplot. The point is that I want a png output. When I use the terminal it just works perfectly, so i get what i want but when i do it trough my application i dont know why is not generating the output.png. Here an example what i do:
//---GNUplot
FILE *pipe;
pipe = popen("/usr/local/bin/gnuplot --persist", "w");
if (pipe != NULL){
fprintf(pipe, "set samples 40\n");
fprintf(pipe, "set isosamples 40\n");
fprintf(pipe, "set hidden3d\n");
fprintf(pipe, "set xrange [-8.000:8.000]\n");
fprintf(pipe, "set yrange [-8.000:8.000]\n");
fprintf(pipe, "set zrange [-2.000:2.000]\n");
fprintf(pipe, "set terminal png\n");
fprintf(pipe, "set output 'jose.png'\n");
fprintf(pipe, "set title 'We are plotting from C'\n");
fprintf(pipe, "set xlabel 'Label X'\n");
fprintf(pipe, "set ylabel 'Label Y'\n");
pclose(pipe);
}
//---end
Any clue about what I am doing bad??
Many thanks in advance
Jose