How to open multiple root files via a for loop

I wanna open three files through a for loop. I define a string type vector to story the file names. But it turns out erro. the error tip is "no matching function for call to ‘Open’
TFile *fvar=TFile::Open(fileNames[i]); candidate function not viable: no known conversion from ‘std::__cxx11::string *’
(aka ‘basic_string *’) to ‘const char *’ for 1st argument ". How to fix this problem? thanks.


TFile *fvar=TFile::Open(fileNames[i].c_str());

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.