【发布时间】:2016-05-31 19:40:02
【问题描述】:
大家好,我有以下问题。我一直在使用 C++ 来抓取网站,用于在 outputHTML 中找到 5 个最常见的单词,它是字符串。目前我有以下代码。任何提示都会很棒。
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &htmlOutput);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
std::cout << htmlOutput << std::endl;
}
【问题讨论】:
-
提示:使用
std::map<std::string, unsigned int>。 -
提示:Frequency