Input string/int in a file name

Hi, is there a way to put an input value into a SaveAs file name?
I have lot of saveas and i don’t want to change manually all the name of the file for each canvas i save.

Use TString::Form, with the same syntax as printf; e.g. supposing x is an integer:

canvas->SaveAs(Form("%s%d%s","image",x,".png"));

i have an error

error: too many arguments to function call, expected at most 2, have 4

Sorry, I omitted Form; corrected now.

now it works!
If i want to put a string instead, is it possible?

Absolutely:

std::string aa = "abcd"; // your string
TCanvas *c1 = new TCanvas("c1", "My canvas", 0, 0, 600, 480); // an empty canvas
c1->SaveAs(Form("CanvasTitled_%s.png", aa.c_str())); // %s will be replaced with abcd

gives

Info in <TCanvas::Print>: file CanvasTitled_abcd.png has been created

thank you all for your help!!