Ok, I have this homework assignment, (and yes it sis a homework assignment so im not asking anyone to write the code for me but i really need the help to figure out why this is thing isnt working!!! ) ok, so anyway, i am basically reading in all the names of files in a directory and then reading in each one of the files (word by word) into a vector. so i basically have a nested vector (i know that there are better ways of doing this, but i have to do it this way) so, i have it all working up to the part where i have to read in the actual file. I am using the ifstream to get the input, as you can see in the code, i have an object called infile and then use the open function to open the desired file (the interesting thing there is that the name of the file has to be a c-string) and then i go into a while loop to read in all the data. i hope that this is some simple syntax error that im just not seeing, and help would be very very appreciated thanks!
oh and the filter function just makes everything lower case and strips any punctuation (it was written by my professor and works, so i didnt include it)
oh and the filter function just makes everything lower case and strips any punctuation (it was written by my professor and works, so i didnt include it)
Code:
ifstream infile;
cout << "DEBUG: ifstream object created" << endl;
infile.open(charFilename, ifstream::in);
cout << "DEBUG: read in the file using the 'open' command" << endl;
cout << "Debug: Prepare to enter the while loop, using the eof() command here" << endl;
while( !infile.eof()){
cout << "DEBUG: Enter the while loop" << endl;
string word;
infile >> word;
filter(word);
setSet[i].push_back(word);
cout << "DEBUG: Exit the while loop" << endl;
}