I implemented a read settings function to be used when a search is executed. Currently, it reads the CSV line by line which will be delimited during execution to separate keywords and URLs.
I also removed the URL counter function and file as they are not needed anymore.
The problem is that running a search for each keyword will be quite slow. Searching for all the keywords in a run would be better.
Here's my code:
void CSV_Handler::ReadSettings()
{
std::ifstream settingsCSV;
settingsCSV.open("../settings/settings.csv");
if(!settingsCSV.is_open())
{
std::cout << std::strerror(errno) << std::endl;
exit(errno);
}
std::string column;
std::vector<std::string> keywordsAndUrls;
while(getline(settingsCSV ,column, '\n'))
{
keywordsAndUrls.push_back(column);
}
for (const auto &content : keywordsAndUrls)
{
std::cout << "Content: " << content << std::endl;
}
settingsCSV.close();
}
This works but I need to separate URLs and keywords here.