Substituting a string using %s? in a non_pringf circumstance

Hi,

I have a questions of substituting a string with %s…

Now I have some of my codes looking like this:

TH2D* PlotFiberBarcode_a(TString filename = “2015_10-28.root”)
{
TString barcode_name = filename;
barcode_name.ReplaceAll(".root","_fiber_barcode");
gStyle->SetOptStat(1000011);
char histname[256];
sprintf( histname, barcode_name.Data());
TH2D* hist = new TH2D( histname , histname, 1000,1,0,799, 0.5, 799.5 );
………………

TCanvas* c1 = new TCanvas(histname, histname,1800,1200);

hist->Draw("COLZ");
   	[b]c1->SaveAs("histo1/ %c.gif", histname);[/b] //histo1 is the directory
return hist;	

}

My goal is to name the image (.gif) of the histogram according to its original ROOT file name. So in this case, I should get the image saved to be: 2015_10-28_fiber_barcode.gif (also it will be saved to a directory called histo1)

The only method I can think of is by using %c (or something similar). But now it can be saved to histo1 as %c.gif… Can someone help me to save the image in the name I want? Thank you!!

Try:
c1->SaveAs(TString::Format(“histo1/%s.gif”, histname));