File existence check using TFile

Hi,

I would like to program file open routine
to look for alternative file if the first file doesn’t exist like:

ifstream in_file;
in_file.open(“file.root”);

if (in_file.fail()) {
in_file.open(“file2.root”);
}

How can I do like above using TFile?

TFile in_file ;
in_file->Open(“file.root”);
in_file->Fail(); <-- there is no such a function…

Hi,

For TFile instead of :in_file->Fail(); <-- there is no such a functionusein_file->IsZombie();

Cheers,
Philippe.