Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/09/2006, 10:53
Avatar de Warlord_Furia
Warlord_Furia
 
Fecha de Ingreso: mayo-2005
Mensajes: 31
Antigüedad: 19 años
Puntos: 0
Cita:
Iniciado por Nivel7 Ver Mensaje
No conosco tal programa, pero suena mas como una libreria.
las forma en que puedes usarla seria a traves de una libreria estatica o una DLL.
ademas es necesario tener los ficheros de cabecera de este programa o libreria.
verifica que es lo que trae con sigo este programa.
Saludos.
Pues este aporte no me ayudo en nada.
He buscado información en la red y hay muchos que como yo Buscan la Manera de Invocar el GNUPlot con el C++.

Lo unico que pude encontrar fue un comentario en el cual se explica la manera de invocar este programa desde la linea de codigo de c++, pero a decir verdad no entendi absolutamente nada. ya que, se trataba de un caso particular.

Aqui el Comentario (Ingles).

este es el caso del cual no entendi nada solo se que son indicaciones para que el programa termine cuando el gnuplot termine el dibujo.

-------------------------------------------------------------------------
Joseph Suprenant wrote:
> Hello all,
> I have a C++ program, it does some calculations on things and then
> prints out a file in the format in which GNUPLOT can use. So my question is
> how would i call GNUPLOT from my C++ program. I know in some operating
> systems you can do system("gnuplot");

system is useless since then you can't pass any commands to GNUplot

> But not with red hat 7.3. So could
> some kind soul help me out? After it starts up GNUPLOT my program will
> terminate.


I've done this on Linux using the popen() function (which is not
standard C++, but POSIX-standard)

class GNUplot {
public:
GNUplot() throw(string);
~GNUplot();
void operator ()(const string& command);
// send any command to gnuplot
protected:
FILE *gnuplotpipe;
};

GNUplot::GNUplot() throw(string) {
gnuplotpipe=popen("gnuplot","w");
if (!gnuplotpipe) {
throw("Gnuplot not found !");
}
}

GNUplot::~GNUplot() {
fprintf(gnuplotpipe,"exit\n");
pclose(gnuplotpipe);
}

void GNUplot:perator() (const string& command) {
fprintf(gnuplotpipe,"%s\n",command.c_str());
fflush(gnuplotpipe);
// flush is necessary, nothing gets plotted else
};


You simply construct one object and invoke it with operator () like

GNUplot plotter;
plotter("plot sin(x)");

Note that GNUplot will be killed as soon as your program terminates. So
you need to wait for keystroke or similar, otherwise you will only see
short flashing of the graph. If you need that the graph window stays on
screen after your pragram fnished, then instead of "gnuplot" in the
constructor invoke "gnuplot -persist".

-------------------------------------------------------------------------
Si alguien tiene información acerca de lo que busco.

¿¿Como invocar al GNUPLot desde la Linea de Codigo de C++ y como hacer uso de este??

Agradesco desde ya!!