Reading files from a list of filenames

Dear Sir,
I am having the following problem while writing a root macro (in C). I have some .root files in a folder which I need to analyse (fit histograms and extracting parameters etc.). I wrote the root filenames in a separate .txt file. My code will read the filenames from the text file and will access the .root files in the parent folder. It should execute the commands until eof is reached.

This is what I have written:

ifstream reco_archive;
reco_archive.opn("filelist.txt");

while(!(reco_archive.eof()))
{
string file_name = getline (cin, "*.root")

if (strstr(file_name, ".root"))
continue;

if (reco_archive.eof())
break;

nRun++;

...
...
...
}

I am almost sure the error is in the bold-typed line...I am not sure how to read the filenames and to connnect them to the actual rootfiles in the same folder. Can anyone please help me?

-regards,
Kolahal
Topic archived. No new replies allowed.