Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

draw graph from CGI script on C/C++

Status
Not open for further replies.

LeonKolchin

Programmer
Apr 10, 2001
1
IL
Hello, I wrote CGI script with C/C++ which gets some data from user through the form and makes a file with X and Y coords like:
10 0.155
11 0.142
12 0.116
Now I want to build graph from this file.
I have gnuplot script which makes txttops convertion, it works fine from the command line but not from CGI script: I wrote in the script - system("gnuplot image.gnu"); it's not working even if I give the full path to gnuplot(why?)
image.gnu some example use of popen for this cause(if I understood it right, and I doubt) and tried it and it's worked for gnuplot, see below:
#define CONVERT_PS "/usr/local/bin/gnuplot image.gnu"
main(){
....
FILE *fi;
fi=popen(CONVERT_PS,"w");
if (fi==NULL)
printf("Sorry can not convert to txt->ps");
pclose(fi);

But it's not working for gs(ghostscript) then I wrote:
#define CONVERT_GIF "/usr/local/bin/gs -q -r200 -sDEVICE=gif8 -sOutputFile=image.gif -dNOPAUSE image.ps quit.ps"

fi=popen(CONVERT_GIF,"w");
if (fi==NULL)
printf("Sorry can not convert to txt->ps");
pclose(fi);
....
}

Do you know what is the problem here???
Thanks in advance

P.S.: I tried to install Netpbm package on my account but unsuccessfully, it told me that there is a syntax problem in the makefile. I need to install only one util on this server and it's ppmtogif, is there a way to install only this one separately, if you have it please send me one for Unix, on Linux I have this binary file but it doesn't suit to Unix.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top