curl-library
Re: What is the best way to debug this?
Date: Sun, 15 Jul 2012 14:34:06 +0200
"Igor Korot" <ikorot01_at_gmail.com> wrote:
> Here is my code:
>
> [code]
> struct curl_slist *post = NULL;
> char *data;
> sprintf( data, "---------------------------%x",
> static_cast<unsigned int>( time( NULL ) ) );
> post = curl_slist_append( post, "Content-Type: multipart/form-data" );
> post = curl_slist_append( post, "Expect: 100-continue" );
> post = curl_slist_append( post, "Connection: keep-alive" );
> curl_easy_setopt( handle, CURLOPT_READFUNCTION, CWindowPanel::put_data );
> curl_easy_setopt( handle, CURLOPT_READDATA, &data );
You call sprintf() with a data pointer initialised where? 'data' points to
a random location. Strange it doesn't crash. think you should do
char data[100];
snprintf (data, sizeof(data), "...");
And be careful using C++ functions as callbacks.
--gv
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-07-15