<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Probleme mit libcurl CURLOPT_WRITEFUNCTION]]></title><description><![CDATA[<p>Guten Abend die Herren,</p>
<p>ich schreibe grade eine Wrapperklasse für libcurl um .json Datein runterladen zu können. Folgendes Problem:</p>
<pre><code>size_t libcurlWrapper::write_data(void *ptr, size_t size, size_t nmemb, FILE *stream){
    size_t written = fwrite(ptr, size, nmemb, stream);
    return written;
}

bool libcurlWrapper::performRequest(char* outfilename){
    if(m_curl){
        m_fp = fopen(outfilename, &quot;wb&quot;);
        curl_easy_setopt(m_curl, CURLOPT_URL, m_url);
        curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, write_data);
        curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, m_fp);
        m_res = curl_easy_perform(m_curl);
        curl_easy_cleanup(m_curl);
        fclose(m_fp);
        return true;
    }else{
        return false;
    }
}
</code></pre>
<pre><code>libcurlwrapper.cpp:-1: In member function 'bool libcurlWrapper::performRequest(char*)':
libcurlwrapper.cpp:24: Fehler: invalid use of member function (did you forget the '()' ?)
         curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, write_data);
         ^
</code></pre>
<p>Ich habe diverse Beispiele im Internet gefunden die genau so wie in meinem Codebeispiel vorgehen. Verstehe nicht was hier schief läuft.<br />
Ich hoffe ihr könnt mir da weiter helfen.</p>
<p>Mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/338251/probleme-mit-libcurl-curlopt_writefunction</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 16:48:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/338251.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 02 Jun 2016 20:58:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit libcurl CURLOPT_WRITEFUNCTION on Thu, 02 Jun 2016 20:59:59 GMT]]></title><description><![CDATA[<p>Guten Abend die Herren,</p>
<p>ich schreibe grade eine Wrapperklasse für libcurl um .json Datein runterladen zu können. Folgendes Problem:</p>
<pre><code>size_t libcurlWrapper::write_data(void *ptr, size_t size, size_t nmemb, FILE *stream){
    size_t written = fwrite(ptr, size, nmemb, stream);
    return written;
}

bool libcurlWrapper::performRequest(char* outfilename){
    if(m_curl){
        m_fp = fopen(outfilename, &quot;wb&quot;);
        curl_easy_setopt(m_curl, CURLOPT_URL, m_url);
        curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, write_data);
        curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, m_fp);
        m_res = curl_easy_perform(m_curl);
        curl_easy_cleanup(m_curl);
        fclose(m_fp);
        return true;
    }else{
        return false;
    }
}
</code></pre>
<pre><code>libcurlwrapper.cpp:-1: In member function 'bool libcurlWrapper::performRequest(char*)':
libcurlwrapper.cpp:24: Fehler: invalid use of member function (did you forget the '()' ?)
         curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, write_data);
         ^
</code></pre>
<p>Ich habe diverse Beispiele im Internet gefunden die genau so wie in meinem Codebeispiel vorgehen. Verstehe nicht was hier schief läuft.<br />
Ich hoffe ihr könnt mir da weiter helfen.</p>
<p>Mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2497765</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2497765</guid><dc:creator><![CDATA[Impi_]]></dc:creator><pubDate>Thu, 02 Jun 2016 20:59:59 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit libcurl CURLOPT_WRITEFUNCTION on Thu, 02 Jun 2016 21:25:16 GMT]]></title><description><![CDATA[<p>Das riecht irgendwie nach einem Fehler, dessen eigentliche Ursache durch irgendwelches Makrogeraffel verdeckt wird, wie es in C-Bibliotheken leider oft anzutreffen ist.<br />
Ohne jetzt die genaue Ursache bestimmen zu können, würde ich dir auf jeden Fall raten erstmal sicherzustellen, dass der Compiler weiss, dass du einen C-Header einbindest:</p>
<pre><code>extern &quot;C&quot; {
   #include &lt;curl.h&gt;
}
</code></pre>
<p>... und es dann nochmal versuchen. Möglicherweise hilft das schon.</p>
<p>Gruss,<br />
Finnegan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2497767</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2497767</guid><dc:creator><![CDATA[Finnegan]]></dc:creator><pubDate>Thu, 02 Jun 2016 21:25:16 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit libcurl CURLOPT_WRITEFUNCTION on Thu, 02 Jun 2016 21:56:28 GMT]]></title><description><![CDATA[<p>Ich denke, die Meldung bezieht sich auf write_data. Adressen von Memberfunktionen erhält man nur mit &amp; vor dem Funktionsnamen.</p>
<p>Ist die Funktion static? Sonst kommt die nächste Meldung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2497769</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2497769</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Thu, 02 Jun 2016 21:56:28 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit libcurl CURLOPT_WRITEFUNCTION on Thu, 02 Jun 2016 22:16:12 GMT]]></title><description><![CDATA[<p>Es hat geholfen die Funktion static zu machen! Finnegan dein Ansatz hat leider nicht zum Erfolg geführt. Trotzdem Danke<br />
Schönen Abend noch</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2497770</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2497770</guid><dc:creator><![CDATA[Impi_]]></dc:creator><pubDate>Thu, 02 Jun 2016 22:16:12 GMT</pubDate></item></channel></rss>