我有一个需要打开的文件名数组。当我放入plans.open。它给我一个错误“没有匹配函数来调用'std :: basic_ifstream :: open(std :: __ cxx11:...'')
#include <iostream>
#include <fstream>
#include <cstring>
#include <string>
using namespace std;
int main(){
ifstream files;
ifstream plans;
string stufiles[100];
int numFiles,timeBlocks;
files.open("filesToProcess.txt");
if (files.fail()){ //checks to see if the selected store file opened
cout << "Error when opening file!" << endl;
return 0;
}
files >> numFiles;
for (int i= 0; i<= numFiles; i++) {
files >> stufiles[i];
}
files.close();
cout << stufiles[0] << endl;
plans.open(stufiles[0]);
if (plans.fail()){ //checks to see if the selected store file opened
cout << "Error when opening file!" << endl;
return 0;
}
}
这应该使用数组中的文件名打开文件。 它给我一个错误“没有匹配函数来调用'std :: basic_ifstream :: open(std :: __ cxx11:...'')