C ++ - Warnung: veraltete Konvertierung von String-Konstante in 'char *' [-Write-Strings]

Ich bin mit gnuplot ein Diagramm zeichnen in C++. Der graph wird plot als erwartet, aber es ist auch eine Warnung beim kompilieren. 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);
}

InformationsquelleAutor der Frage Sagar | 2014-02-03

Schreibe einen Kommentar