TFile::Open and GetListOfKeys

Hello All,
Before posting I searched the tutorials with the ROOT install to see how GetListOfKeys was used. Almost all the example have the invocation like this:

TFile fileA("foam_demo.root"); fileA.GetListOfKeys()->Print();

For error checking, I open my root file like this:

TFile *rfile = TFile::Open(ROOTfilename); if (!rfile) { printf("Cannot open ROOT file: %s \n",ROOTfilename); fclose(CONFIG); fclose(templatefile); fclose(output); exit(2); }

My question is how do I print the list of keys. I tried

which did not work. ( error: request for member ‘GetListOfKeys’ in ‘rfile’, which is of non-class type ‘TFile*’).

thanks.

Karthik.

do

rfile->GetListOfKeys()->Print(); or

rfile->GetListOfKeys()->ls; or

rfile->ls();
Rene

Thanks Brun.

rfile->GetListOfKeys()->Print();

worked.

The other 2 did not. “Error: Symbol rfile is not defined in current scope addrootfiles.C:75:”

But the first method solved the question. Thanks once again.