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] Assuming I am trying the open the first file in the list: inputFile.open(filelist[0].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