Hi
I am trying to do this
char *f[100];
char *fn [100];
f = histo->GetName();
sprintf(fn,"2D/%s.pdf",f);
c1->Print(fn,"pdf");
but the code keeps crashing…What am I doing wrong ?
Thanks
Alex
Hi
I am trying to do this
char *f[100];
char *fn [100];
f = histo->GetName();
sprintf(fn,"2D/%s.pdf",f);
c1->Print(fn,"pdf");
but the code keeps crashing…What am I doing wrong ?
Thanks
Alex
const char *f;
char fn[100];
even so, the file is saved with the non-sense characters
: pdf file 2D/�]�m�.pdf has been created
Info in <TCanvas::Print>: pdf file 2D/�]�m�.pdf has been created
Info in <TCanvas::Print>: pdf file 2D/�]�m�.pdf has been created
Info in <TCanvas::Print>: pdf file 2D/�]�m�.pdf has been created
What do you get when you try:
std::cout << “->” << histo->GetName() << “<-” << std::endl;
something like this
->1D_C1N2_100_LSP1_B_met_MTsum_13<-
ie I have “_” characters but no spaces
Try directly (don’t use “f”):
sprintf(fn, “2D/%s.pdf”, histo->GetName());
or even better (don’t use “f” nor “fn”):
c1->Print(TString::Format(“2D/%s.pdf”, histo->GetName()), “pdf”);