<?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 absturtz]]></title><description><![CDATA[<p>Ich hoffe ich bin jier richtig...</p>
<p>Ich programiere mit wxDev C++ und atbeite mich gerade in libcurl ein. Ich will nur erreichen, dass mir eine Internetseite in einen String übergeben wird...</p>
<pre><code class="language-cpp">/*****************************************************************************
 *                                  _   _ ____  _
 *  Project                     ___| | | |  _ \| |
 *                             / __| | | | |_) | |
 *                            | (__| |_| |  _ &lt;| |___
 *                             \___|\___/|_| \_\_____|
 *
 * $Id: simple.c,v 1.6 2004/08/23 14:22:52 bagder Exp $
 */

#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include &lt;curl/curl.h&gt;

int curl_writeCallback(char *inBuffer, size_t size, size_t nmemb, std::string *outBuffer)
{
    outBuffer-&gt;append(inBuffer);
    return size*nmemb;
}

int main(void)
{
  CURL *curl;
  CURLcode res;
  std::string out;

  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, &quot;curl.haxx.se&quot;);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_writeCallback);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, out);
    res = curl_easy_perform(curl);

    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  return 0;
}
</code></pre>
<p>Das ist mein aktueller Code... doch das Programm stürzt in diesem Zustand ab... es giebt aber keine Fehler beim compilen.</p>
<p>Der Debugger sagt mir bei dieser Zeile:</p>
<pre><code class="language-cpp">curl_easy_setopt(curl, CURLOPT_WRITEDATA, out);
</code></pre>
<p>&quot;Eine Zugriffsverletzung/Segmention fault) trat in ihrem Programm auf&quot;</p>
<p>Ich sitzte schon den ganzen tag mit mehreren verschiedenen Beispielen da doch es klappt einfach nicht. Ich hoffe mir kann jemand helfen.</p>
<p>InFaIN</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/229511/libcurl-absturtz</link><generator>RSS for Node</generator><lastBuildDate>Sun, 27 Sep 2026 20:28:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/229511.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 12 Dec 2008 19:08:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to libcurl absturtz on Fri, 12 Dec 2008 19:08:14 GMT]]></title><description><![CDATA[<p>Ich hoffe ich bin jier richtig...</p>
<p>Ich programiere mit wxDev C++ und atbeite mich gerade in libcurl ein. Ich will nur erreichen, dass mir eine Internetseite in einen String übergeben wird...</p>
<pre><code class="language-cpp">/*****************************************************************************
 *                                  _   _ ____  _
 *  Project                     ___| | | |  _ \| |
 *                             / __| | | | |_) | |
 *                            | (__| |_| |  _ &lt;| |___
 *                             \___|\___/|_| \_\_____|
 *
 * $Id: simple.c,v 1.6 2004/08/23 14:22:52 bagder Exp $
 */

#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include &lt;curl/curl.h&gt;

int curl_writeCallback(char *inBuffer, size_t size, size_t nmemb, std::string *outBuffer)
{
    outBuffer-&gt;append(inBuffer);
    return size*nmemb;
}

int main(void)
{
  CURL *curl;
  CURLcode res;
  std::string out;

  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, &quot;curl.haxx.se&quot;);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_writeCallback);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, out);
    res = curl_easy_perform(curl);

    /* always cleanup */
    curl_easy_cleanup(curl);
  }
  return 0;
}
</code></pre>
<p>Das ist mein aktueller Code... doch das Programm stürzt in diesem Zustand ab... es giebt aber keine Fehler beim compilen.</p>
<p>Der Debugger sagt mir bei dieser Zeile:</p>
<pre><code class="language-cpp">curl_easy_setopt(curl, CURLOPT_WRITEDATA, out);
</code></pre>
<p>&quot;Eine Zugriffsverletzung/Segmention fault) trat in ihrem Programm auf&quot;</p>
<p>Ich sitzte schon den ganzen tag mit mehreren verschiedenen Beispielen da doch es klappt einfach nicht. Ich hoffe mir kann jemand helfen.</p>
<p>InFaIN</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1629658</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1629658</guid><dc:creator><![CDATA[InFaIN]]></dc:creator><pubDate>Fri, 12 Dec 2008 19:08:14 GMT</pubDate></item><item><title><![CDATA[Reply to libcurl absturtz on Fri, 12 Dec 2008 19:21:23 GMT]]></title><description><![CDATA[<p>Kommando zurück - du übergibst der curl-funktion nicht einen Zeiger auf deinen String, sondern eine Kopie des Strings. Pack ein &amp; vor out in der entsprechenden Zeile. Hoffe, dann klappts.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1629666</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1629666</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 12 Dec 2008 19:21:23 GMT</pubDate></item><item><title><![CDATA[Reply to libcurl absturtz on Sat, 13 Dec 2008 07:37:38 GMT]]></title><description><![CDATA[<p>VIelen dank für deine Hilfe... mit dem &amp; klappt es prima..</p>
<p>InFaIN</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1629819</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1629819</guid><dc:creator><![CDATA[InFaIN]]></dc:creator><pubDate>Sat, 13 Dec 2008 07:37:38 GMT</pubDate></item></channel></rss>