我想打开多个文本文件并将流存储为矢量。打开多个文本文件的流
#include <vector>
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
vector<string> imgSet
vector<ofstream> txtFiles;
// .
// .
for(int i=0 ; i<imgSet.size() ; i++)
{
ofstream s;
s.open(imgSet[i].getName(), std::ofstream::out);
txtFiles.push_back(s);
}
}
的getName样子:
const string& getName() const;
我编译这个与G ++ ubuntu上,我不明白为什么我得到它的错误一长串。如何解决这个问题
什么是'imgSet [i] .getName()'? 'std :: string'没有成员函数'getName()'。 – 2014-11-21 10:51:12