我正在使用gnuplot在C ++中绘制图形。该图形正在按预期方式绘制,但是在编译过程中会出现警告。警告是什么意思?
warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
这是我正在使用的功能:
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);
}
慕妹3242003
相关分类