I have a variable f declared as a vector::iterator and I have it pointed to a c_str() because I am trying to read files from a directory . The code complied at first but none of my functions were begin called. Show can I write my class and function to allow me to pass it and use it in another function:
This is part of the code in int main().
int main() {
vector<string> files;
if (d) {
//we successfully opened the directory
//while there's still something we haven't looked at
while ((dir = readdir(d)) != NULL) {
//get the name of that thing
string filename = dir->d_name;
//filter out what we don't want
if (filename == "." || //filter out current dir
filename == ".." || //filter out parent dir
filename.find(".csv") == string::npos) //here is where you set up the match
continue;
//and add what we do want to our files data structure
files.push_back(basepath + "/" + filename);
}
}
map<string, int> foo;
double fail = 0;
for (vector<string>::iterator f = files.begin(); f != files.end(); ++f) {
Extract_Organize process;
cout << "What";
process.transform();
process.create_file();
cout << "Finished!\n";
}
return 0;
}
class Extract_Organize {
public:
Extract_Organize;
void transform();
void create_file();
string double_integrate(int, int);
};
#endif
I’m guessing the problem is:
when it should be
There are tons of questions about most vexing parse here on StackOverflow, but the bottom line is that your code declares a function called
processinstead of creating an objectExtract_Organize.