From: Jorge G. <jor...@gm...> - 2008-06-16 01:05:16
|
hi how write this in c++?, could i use <fstream> this it´s ok, (c and gnuplot) /******/ #include <stdio.h> #include <stdlib.h> #define GNUPLOT_PATH "D:/instaladores/gnuplot/gnuplot/bin/pgnuplot" int main (int argc, const char * argv[]) { FILE *gp; gp = popen(GNUPLOT_PATH, "w"); if(gp == NULL){ fprintf(stderr, "Oops, I can't find %s.", GNUPLOT_PATH); exit(EXIT_FAILURE); } //fprintf(gp, "set term aqua title \"Function A\" \n"); fprintf(gp, "set samples 2048 \n"); fprintf(gp, "plot [-512:512] -abs(x*sin(sqrt(abs(x))))+400\n"); fflush(gp); getchar(); pclose(gp); return(EXIT_SUCCESS); } /**************/ i have a problem here: /**************/ #include <cstdlib> #include <fstream> #include <iostream> #define GNUPLOT_PATH "D:/instaladores/gnuplot/gnuplot/bin/pgnuplot" using namespace std; int main() { fstream fSalida; fSalida.open(GNUPLOT_PATH,ios::out|ios::app ); //¿¿¿ :-) // cout<<fSalida<<"set samples 2048"<<endl; // cout<<fSalida<<"plot [-512:512] -abs(x*sin(sqrt(abs(x))))+400"<<endl;; system("PAUSE"); return EXIT_SUCCESS; } /**************/ |