I am using gnuplot to draw a graph in C++. The graph is being plot as expected but there is a warning during compilation. What does the warning mean?
warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
This is the function I am using:
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
", xvals[i], yvals[i]);
//Write the data to a te mporary file
}
for (i=0; i < NUM_COMMANDS; i++)
{
fprintf(gnuplotPipe, "%s
", commandsForGnuplot[i]);
//Send commands to gn uplot one by one.
}
fflush(gnuplotPipe);
}
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…