Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #4401

GnuPlot problem from C ++

From Ululì Ululà <ululi@ulu.la>
Newsgroups comp.graphics.apps.gnuplot
Subject GnuPlot problem from C ++
Date 2021-04-22 16:45 +0200
Message-ID <0v238gp11qji3iu4qv4d1mfvtcej541euv@4ax.com> (permalink)

Show all headers | View raw


I state that I am a beginner with C and C ++ and my English is bad.

I have to draw an f (x) on the Cartesian plane using C ++ and Gnuplot.
I have: 

Windows 7 (64 bit)
DEVC ++ Embarcadero compiler Version 6.3
 Gnuplot Version 5.2 patchlevel 8

I call Gnuplot from a DevC ++ program by passing it the string "Frase"
that contains the actions that Gnuplot will have to perform. When I
start the program the graph of f(x) does not respect the information
provided to Gnuplot with the string "Frase": for example the command
"unset key" it is not respected as well as the "set grid" command.
Why?

Below is the listing of my test program and I thank in advance whoever
succeeds to help me.


This is my program:

#include <string>
#include <stdlib.h> 
#include <stdio.h>
#include <math.h>

int main(void) {  

char Frase[300]="plot [1:4] x*x+1;set grid;unset key;set title
'f(x)';set xlabel 'X (m)';set ylabel 'Y (m)';set border \n";


int Funzione;
FILE * iFile, * oFile;

Funzione=4;

 while (Funzione>0)
 {
  system("cls");
  printf("Inserisci Funzione  (0=EXIT) : "); 
  scanf("%d", &Funzione);

   if (Funzione>0)
   {
       oFile = fopen("comando_A.txt", "wt");   
	   fprintf(oFile,Frase);
	   fprintf(oFile,"pause -1"); 
       fclose(oFile);      
       system("gnuplot comando_A.txt");   
    }
  
}

 return(0);  
}

Back to comp.graphics.apps.gnuplot | Previous | NextNext in thread | Find similar


Thread

GnuPlot problem from C ++ Ululì Ululà <ululi@ulu.la> - 2021-04-22 16:45 +0200
  Re: GnuPlot problem from C ++ Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2021-04-22 23:13 +0200
    Re: GnuPlot problem from C ++ Ululì Ululà <ululi@ulu.la> - 2021-04-23 11:50 +0200
    Re: GnuPlot problem from C ++ Juan Humberto Artero Jaimez <artfulel1st@gmail.com> - 2021-05-10 08:19 -0700

csiph-web