1. <small id='FEHvM'></small><noframes id='FEHvM'>

    <i id='FEHvM'><tr id='FEHvM'><dt id='FEHvM'><q id='FEHvM'><span id='FEHvM'><b id='FEHvM'><form id='FEHvM'><ins id='FEHvM'></ins><ul id='FEHvM'></ul><sub id='FEHvM'></sub></form><legend id='FEHvM'></legend><bdo id='FEHvM'><pre id='FEHvM'><center id='FEHvM'></center></pre></bdo></b><th id='FEHvM'></th></span></q></dt></tr></i><div id='FEHvM'><tfoot id='FEHvM'></tfoot><dl id='FEHvM'><fieldset id='FEHvM'></fieldset></dl></div>
    <tfoot id='FEHvM'></tfoot>
    • <bdo id='FEHvM'></bdo><ul id='FEHvM'></ul>

      <legend id='FEHvM'><style id='FEHvM'><dir id='FEHvM'><q id='FEHvM'></q></dir></style></legend>

      curl WRITEFUNCTION 和类

      时间:2023-08-03
        • <bdo id='aof3K'></bdo><ul id='aof3K'></ul>
          <legend id='aof3K'><style id='aof3K'><dir id='aof3K'><q id='aof3K'></q></dir></style></legend>
              <tbody id='aof3K'></tbody>

              <small id='aof3K'></small><noframes id='aof3K'>

              <i id='aof3K'><tr id='aof3K'><dt id='aof3K'><q id='aof3K'><span id='aof3K'><b id='aof3K'><form id='aof3K'><ins id='aof3K'></ins><ul id='aof3K'></ul><sub id='aof3K'></sub></form><legend id='aof3K'></legend><bdo id='aof3K'><pre id='aof3K'><center id='aof3K'></center></pre></bdo></b><th id='aof3K'></th></span></q></dt></tr></i><div id='aof3K'><tfoot id='aof3K'></tfoot><dl id='aof3K'><fieldset id='aof3K'></fieldset></dl></div>

              • <tfoot id='aof3K'></tfoot>
              • 本文介绍了curl WRITEFUNCTION 和类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                class Filter{
                private:
                    string contents;
                    bool Server(void);
                public:
                    void handle(void *, size_t, size_t, void *);
                   };
                

                我有一个这样的类标题.我想在函数 Server 中调用 curl WRITEFUNCTION ,该函数将使用句柄写入字符串内容.虽然它一直给我错误

                i have a class header like this. i want to call curl WRITEFUNCTION inside the function Server which would use handle to write to the string contents. although it keeps giveng me the error

                error: invalid use of member (did you forget the ‘&’ ?)
                

                错误指向的那一行是 CURLOPT_WRITEFUNCTION.... 我的 curl 请求看起来像这样...

                the line pointed by error is that of CURLOPT_WRITEFUNCTION.... My curl request looks something like this...

                curl_easy_setopt(curl,CURLOPT_URL, address.c_str());
                curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,handle);
                curl_easy_perform(curl);
                

                这意味着它无法访问 handle()..我该如何纠正?

                that means its unable to access the handle().. how can i rectify this?

                推荐答案

                string temp;
                
                curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,handle);
                curl_easy_setopt(curl,CURLOPT_WRITEDATA,&temp);
                
                size_t Filter::handle(void *ptr, size_t size, size_t nmemb, string stream)
                {
                    string temp(static_cast<const char*>(ptr), size * nmemb);
                    stream = temp;
                    return size*nmemb;
                }
                

                这就是我让它工作的方式..这会将网站保存到名为 temp 的字符串中.

                thats how i got it to work.. this will save the website to the string named temp.

                这篇关于curl WRITEFUNCTION 和类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:时间:2019-05-16 标签:c++libcurljsonrest 下一篇:使 cURL 与 Visual Studios 2017 一起使用

                相关文章

                最新文章

              • <i id='hYIDX'><tr id='hYIDX'><dt id='hYIDX'><q id='hYIDX'><span id='hYIDX'><b id='hYIDX'><form id='hYIDX'><ins id='hYIDX'></ins><ul id='hYIDX'></ul><sub id='hYIDX'></sub></form><legend id='hYIDX'></legend><bdo id='hYIDX'><pre id='hYIDX'><center id='hYIDX'></center></pre></bdo></b><th id='hYIDX'></th></span></q></dt></tr></i><div id='hYIDX'><tfoot id='hYIDX'></tfoot><dl id='hYIDX'><fieldset id='hYIDX'></fieldset></dl></div>

                1. <small id='hYIDX'></small><noframes id='hYIDX'>

                2. <legend id='hYIDX'><style id='hYIDX'><dir id='hYIDX'><q id='hYIDX'></q></dir></style></legend>
                    <bdo id='hYIDX'></bdo><ul id='hYIDX'></ul>
                  <tfoot id='hYIDX'></tfoot>