I would like to read the "O2008bws.gif"string from my root script, writing it in the “plotname” string and save the plot produced by the root script with this name. I do in the following way, but it gives me errors:
If [quote]name[/quote] is a string, I was expecting [quote]SaveAs(name)[/quote] working, while it tells to me it cannot call “TCanvas::SaveAs(name)” in current scope…
How can I give the name of the plot image without writing it explicitely within quotes?
If I add name.erase(0,1) as I would like to do, it tells me “can’t call name.erase(0,1)”.
Is string name; the right way to define “name” as a string object?
Anar is correct. SaveAs takes as an argument a ‘const char*’ and std::string as no automatic converter to ‘const char*’, hence you must use the explicit call (canvas->SaveAs(name.c_str())