How to read a list of filenames from a text file and open them in C++?
===

I have a list of files stored in a text file. I read the file line by line and store them in a string array. The file list looks like this:

    04_02_1310.csv
    04_03_1350.csv
    04_04_0421.csv
    04_05_0447.csv

and so on. Let's call my string array

    filelist[i]

If i try to open the file using:

    inputFile.open(filelist[i].c_str()); // This cannot open file

the file cannot be opened. If i place the file name in quotation marks, everything works out fine:

    inputFile.open("04_02_1310.csv"); // This works perfectly

if i print the contents of filelist[i], then it works fine as well:

    cout << filelist[0] << endl; // This outputs 04_02_1310.csv on screen.

Can somebody tell me what is wrong with the approach above? This is driving me crazy for the last 2 days, and I am about the enter everything manually just to get it done (100+ files one after another).

I am also open to any other way to do this simple task.

Thanks!!!