C ++ - Warnung: Veraltete Konvertierung von String-Konstante in "char *" [-Wwrite-strings]
Ich benutze Gnuplot, um ein Diagramm in C ++ zu zeichnen. Das Diagramm wird wie erwartet gezeichnet, aber während der Kompilierung wird eine Warnung angezeigt. Was bedeutet die Warnung?
warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
Dies ist die Funktion, die ich benutze:
void plotgraph(double xvals[],double yvals[], int NUM_POINTS)
{
char * commandsForGnuplot[] = {"set title \"Probability Graph\"",
"plot 'data.temp' with lines"};
FILE * temp = fopen("data.temp", "w");
FILE * gnuplotPipe = popen ("gnuplot -persistent ", "w");
int i;
for (i=0; i < NUM_POINTS; i++)
{
fprintf(temp, "%lf %lf \n", xvals[i], yvals[i]);
//Write the data to a te mporary file
}
for (i=0; i < NUM_COMMANDS; i++)
{
fprintf(gnuplotPipe, "%s \n", commandsForGnuplot[i]);
//Send commands to gn uplot one by one.
}
fflush(gnuplotPipe);
}