Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

Time sharing: The use of many people by the computer.


computers / comp.graphics.apps.gnuplot / Re: GnuPlot problem from C ++

SubjectAuthor
* GnuPlot problem from C ++Ululì Ululà
`* Re: GnuPlot problem from C ++Hans-Bernhard_Bröker
 +- Re: GnuPlot problem from C ++Ululì Ululà
 `- Re: GnuPlot problem from C ++Juan Humberto Artero Jaimez

1
Subject: GnuPlot problem from C ++
From: Ululì Ululà
Newsgroups: comp.graphics.apps.gnuplot
Date: Thu, 22 Apr 2021 14:45 UTC
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ulu...@ulu.la (Ululì Ululà)
Newsgroups: comp.graphics.apps.gnuplot
Subject: GnuPlot problem from C ++
Date: Thu, 22 Apr 2021 16:45:42 +0200
Lines: 58
Message-ID: <0v238gp11qji3iu4qv4d1mfvtcej541euv@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: individual.net nXVnlHz742G9eJ6Vem6RZwQRSsqfXbQa3q8T3OcwiE3OhlEYTX
Cancel-Lock: sha1:PrPxyKo7TixLBfW8Zw6IgfpxGcc=
User-Agent: ForteAgent/8.00.32.1272
X-No-Archive: Yes
View all headers

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); 
}


Subject: Re: GnuPlot problem from C ++
From: Hans-Bernhard_Bröke
Newsgroups: comp.graphics.apps.gnuplot
Date: Thu, 22 Apr 2021 21:13 UTC
References: 1
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail
From: HBBroe...@t-online.de (Hans-Bernhard_Bröker)
Newsgroups: comp.graphics.apps.gnuplot
Subject: Re: GnuPlot problem from C ++
Date: Thu, 22 Apr 2021 23:13:11 +0200
Lines: 12
Message-ID: <iee770Fr305U1@mid.dfncis.de>
References: <0v238gp11qji3iu4qv4d1mfvtcej541euv@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.dfncis.de 3II5DqUuxjy1snn1y6/3EgWk1ol6/dyL7Hwzobd/x7p4R+098lABEeorUD
Cancel-Lock: sha1:RBvqZ5Ut38sBOi2uSUjJssHjaiE=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.10.0
In-Reply-To: <0v238gp11qji3iu4qv4d1mfvtcej541euv@4ax.com>
Content-Language: de-DE
View all headers
Am 22.04.2021 um 16:45 schrieb Ulul� Ulul�:

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?
Because the pieces of your command string are in the wrong order.  You put the cart before the horse.

You should really begin by using gnuplot manually for a bit, before you go ahead trying to drive it from another program.



Subject: Re: GnuPlot problem from C ++
From: Ululì Ululà
Newsgroups: comp.graphics.apps.gnuplot
Date: Fri, 23 Apr 2021 09:50 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ulu...@ulu.la (Ululì Ululà)
Newsgroups: comp.graphics.apps.gnuplot
Subject: Re: GnuPlot problem from C ++
Date: Fri, 23 Apr 2021 11:50:46 +0200
Lines: 25
Message-ID: <qs558gts0j03r0i6igpf3vv7j79t6cit4a@4ax.com>
References: <0v238gp11qji3iu4qv4d1mfvtcej541euv@4ax.com> <iee770Fr305U1@mid.dfncis.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net K3+YWeFF5+Q+bbMtOlNi8QeX3HdBWFTI2B1Ve/1V06eaBvQVma
Cancel-Lock: sha1:ttNDV7+3Ozpd0lR5m7u1J+e3I0A=
User-Agent: ForteAgent/8.00.32.1272
X-No-Archive: Yes
View all headers
On Thu, 22 Apr 2021 23:13:11 +0200, Hans-Bernhard Bröker
<HBBroeker@t-online.de> wrote:

Am 22.04.2021 um 16:45 schrieb Ulul? Ulul?:

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?
Because the pieces of your command string are in the wrong order.  You
put the cart before the horse.

You should really begin by using gnuplot manually for a bit, before you
go ahead trying to drive it from another program.

Your phrase "You put the cart before the horse" was enlightening so I
tried to move the horse in front of the cart and the program worked
correctly!


For the rest you are absolutely right: I have to practice more using
Gnuplot manually.

Thanks for the valuable advice and hello from Italy where I live!



Subject: Re: GnuPlot problem from C ++
From: Juan Humberto Artero
Newsgroups: comp.graphics.apps.gnuplot
Date: Mon, 10 May 2021 15:19 UTC
References: 1 2
X-Received: by 2002:a37:8246:: with SMTP id e67mr23401557qkd.410.1620659996798;
Mon, 10 May 2021 08:19:56 -0700 (PDT)
X-Received: by 2002:a25:32d0:: with SMTP id y199mr28888080yby.208.1620659996609;
Mon, 10 May 2021 08:19:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.graphics.apps.gnuplot
Date: Mon, 10 May 2021 08:19:56 -0700 (PDT)
In-Reply-To: <iee770Fr305U1@mid.dfncis.de>
Injection-Info: google-groups.googlegroups.com; posting-host=83.49.155.127; posting-account=1ddZ8woAAAByIEJiUxC1VNYO5_E3NCJE
NNTP-Posting-Host: 83.49.155.127
References: <0v238gp11qji3iu4qv4d1mfvtcej541euv@4ax.com> <iee770Fr305U1@mid.dfncis.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2fe58493-ac2b-4845-8242-51dc93ca9721n@googlegroups.com>
Subject: Re: GnuPlot problem from C ++
From: artfulel...@gmail.com (Juan Humberto Artero Jaimez)
Injection-Date: Mon, 10 May 2021 15:19:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
View all headers
El jueves, 22 de abril de 2021 a las 23:13:06 UTC+2, Hans-Bernhard Bröker escribió:
Am 22.04.2021 um 16:45 schrieb Ulul� Ulul�:

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?
Because the pieces of your command string are in the wrong order. You
put the cart before the horse.

You should really begin by using gnuplot manually for a bit, before you
go ahead trying to drive it from another program.


1
rocksolid light 0.7.2
clearneti2ptor