<?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[libcurl writefunction, erbitte Beispiel]]></title><description><![CDATA[<p>Was ich versuche zu reichen ist, den Quelltext den mir folgender Code unter anderen inne Konsole schreibt in einem String zu speichern.<br />
Das Problem dabei ist jedoch, das ich nicht weiß wie ich die Writefunction setzen kann, und die Seite von denen mir dabei auch nicht weiterhilft.<br />
hier wird auch ein Prototyp angegeben, der sagt mir leider nichts <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p><a href="http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTWRITEFUNCTION" rel="nofollow">http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTWRITEFUNCTION</a></p>
<p>Für jegliche Hilfe wäre ich echt dankbar.</p>
<p>Mein relevanter Code</p>
<pre><code class="language-cpp">void Updater::Initialize(){
	this-&gt;SetMainStatus(&quot;Checking for Updates&quot;);
	CURL *curl = curl_easy_init();
	if(curl){
		this-&gt;SetMainStatus(&quot;Downloading Version Info&quot;);
		curl_easy_setopt(curl, CURLOPT_URL, &quot;http://empirephoenix.de/New_Horizons/Client/list.txt&quot;);
		//curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, );
		CURLcode res = curl_easy_perform(curl);
	}else{
		this-&gt;SetMainStatus(&quot;Connection Failture&quot;);
	}
	curl_easy_cleanup(curl);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/247352/libcurl-writefunction-erbitte-beispiel</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 05:43:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/247352.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 09 Aug 2009 21:46:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to libcurl writefunction, erbitte Beispiel on Sun, 09 Aug 2009 21:46:23 GMT]]></title><description><![CDATA[<p>Was ich versuche zu reichen ist, den Quelltext den mir folgender Code unter anderen inne Konsole schreibt in einem String zu speichern.<br />
Das Problem dabei ist jedoch, das ich nicht weiß wie ich die Writefunction setzen kann, und die Seite von denen mir dabei auch nicht weiterhilft.<br />
hier wird auch ein Prototyp angegeben, der sagt mir leider nichts <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p><a href="http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTWRITEFUNCTION" rel="nofollow">http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTWRITEFUNCTION</a></p>
<p>Für jegliche Hilfe wäre ich echt dankbar.</p>
<p>Mein relevanter Code</p>
<pre><code class="language-cpp">void Updater::Initialize(){
	this-&gt;SetMainStatus(&quot;Checking for Updates&quot;);
	CURL *curl = curl_easy_init();
	if(curl){
		this-&gt;SetMainStatus(&quot;Downloading Version Info&quot;);
		curl_easy_setopt(curl, CURLOPT_URL, &quot;http://empirephoenix.de/New_Horizons/Client/list.txt&quot;);
		//curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, );
		CURLcode res = curl_easy_perform(curl);
	}else{
		this-&gt;SetMainStatus(&quot;Connection Failture&quot;);
	}
	curl_easy_cleanup(curl);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1758048</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1758048</guid><dc:creator><![CDATA[Empire Phoenix]]></dc:creator><pubDate>Sun, 09 Aug 2009 21:46:23 GMT</pubDate></item><item><title><![CDATA[Reply to libcurl writefunction, erbitte Beispiel on Sun, 09 Aug 2009 21:58:48 GMT]]></title><description><![CDATA[<p>Hi.<br />
Ich weiß nicht ob das auch in C++ geht, da curl in PHP jedoch nur ein Wrapper für libcurl ist sollte es gehen.</p>
<p><a href="http://de.php.net/manual/en/function.curl-setopt.php" rel="nofollow">http://de.php.net/manual/en/function.curl-setopt.php</a></p>
<p>Ich setze CURLOPT_RETURNTRANSFER immer auf 1 und dann funktionierts <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1758054</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1758054</guid><dc:creator><![CDATA[theliquidwave]]></dc:creator><pubDate>Sun, 09 Aug 2009 21:58:48 GMT</pubDate></item><item><title><![CDATA[Reply to libcurl writefunction, erbitte Beispiel on Sun, 09 Aug 2009 23:14:30 GMT]]></title><description><![CDATA[<p>hm ne schade geht leider nicht, kennt er nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Mal sehen ob ich was im Wrapper finde was hilft (wobei meine php Kenntnisse gefährlich schlecht sind ^^)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1758070</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1758070</guid><dc:creator><![CDATA[Empire Phoenix]]></dc:creator><pubDate>Sun, 09 Aug 2009 23:14:30 GMT</pubDate></item><item><title><![CDATA[Reply to libcurl writefunction, erbitte Beispiel on Mon, 10 Aug 2009 00:30:09 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">// This is the writer call back function used by curl
static int writer(char *data, size_t size, size_t nmemb,
                  std::string *buffer)
{
  // What we will return
  int result = 0;

  // Is there anything in the buffer?
  if (buffer != NULL)
  {
    // Append the data to the buffer
    buffer-&gt;append(data, size * nmemb);

    // How much did we write?
    result = size * nmemb;
  }

  return result;
}

// ...
std::string buffer;

curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &amp;buffer);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1758077</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1758077</guid><dc:creator><![CDATA[asdasdasdasdasdasdasdasd]]></dc:creator><pubDate>Mon, 10 Aug 2009 00:30:09 GMT</pubDate></item><item><title><![CDATA[Reply to libcurl writefunction, erbitte Beispiel on Mon, 10 Aug 2009 08:51:12 GMT]]></title><description><![CDATA[<p>Super, danke funktioniert perfekt.</p>
<p>Was mich jedoch wundert, warum muss man sowohl CURLOPT_WRITEFUNCTION als auch CURLOPT_WRITEDATA benutzen? Die Writefunction kümmert sich ja schon um das schreiben in den buffer.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1758130</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1758130</guid><dc:creator><![CDATA[Empire Phoenix]]></dc:creator><pubDate>Mon, 10 Aug 2009 08:51:12 GMT</pubDate></item><item><title><![CDATA[Reply to libcurl writefunction, erbitte Beispiel on Tue, 12 Jan 2010 10:59:22 GMT]]></title><description><![CDATA[<p>sry dass ich den alten text raushole. Aber ich habe da eine Frage dazu <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<pre><code>// This is the writer call back function used by curl
static int writer(char *data, size_t size, size_t nmemb,
                  std::string *buffer)
{
  // What we will return
  int result = 0;

  // Is there anything in the buffer?
  if (buffer != NULL)
  {
    // Append the data to the buffer
    buffer-&gt;append(data, size * nmemb);

    // How much did we write?
    result = size * nmemb;
  }

  return result;
}

// ...
std::string buffer;

curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writer);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &amp;buffer);
</code></pre>
<p>Die Function &quot;Writer&quot; returned die größe wieviel geschrieben wurde oder ?</p>
<p>Was ich nicht verstehe ist, wo holt er den content der page her ?</p>
<p>&quot;curl_easy_setopt&quot; wird die Url uebergeben, mit curl (bzw. pointer auf die URL)<br />
soweit richtig ?</p>
<p>Quay suche ich eine Lösung, um den content einer page zu holen und diesen content in einem string zu speichern, <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>merci</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1837422</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837422</guid><dc:creator><![CDATA[andera]]></dc:creator><pubDate>Tue, 12 Jan 2010 10:59:22 GMT</pubDate></item></channel></rss>