I am a little confused about using TFile in the same way one writes this statement in C:
I want to read a root file, but it it does not exist I want to exit gracefully.
Right now it crashes with this error:
How do I check for the existence of the file and if it exist I want to open it just like I can do with :
Thanks a lot.
TFile *file = TFile::Open(“myfile.root”);
if (!file) /file open failed
see also TFile::Recover
Thanks Rene for the message. I tried that but I am missing something.
I am reading the names of the root files to open from a text configuration file.
TFile *file = Tfile::Open(ROOTfilename);
gives an error.
Error: Function Open(ROOTfilename) is not defined in current scope makelistmode.C:39:[/i]
It must be TFile::Open and not Tfile::Open