问题描述
我有这个程序:
#include<iostream>
#include<curl/curl.h>
#include"Header.h"
size_t Data::write_callback(char* ptr,size_t size,size_t nmemb,void* userdata) {
size_t instant_size = size * nmemb;
for (int i = 0; i < instant_size; i++) {
this->html.push_back(ptr[i]);
}
return instant_size;
}
void Data::setUrl(std::string url){
this->url = url;
}
std::string Data::getHtml(void) {
curl_global_init(CURL_GLOBAL_ALL);
CURL* easy_handle = curl_easy_init();
curl_easy_setopt(easy_handle,CURLOPT_URL,this->url);
curl_easy_setopt(easy_handle,CURLOPT_WRITEFUNCTION,write_callback);
curl_easy_perform(easy_handle);
curl_easy_cleanup(easy_handle);
curl_global_cleanup();
return html;
}
头文件是:
#include<iostream>
class Data {
std::string html;
std::string url;
size_t write_callback(char*,size_t,void*);
public:
Data();
void setUrl(std::string);
std::string getHtml();
};
当我运行程序时,我得到:
错误 C3867 'Data::write_callback':非标准语法;使用 '&' 创建一个指向成员的指针
有人可以帮我吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)