Hi again Stefano, I became curious and read the beginning of the libcurl tutorial at http://curl.haxx.se/libcurl/c/libcurl-tutorial.html. It seems quite clear that both curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writefunction) and curl_easy_setopt(handle, CURLOPT_WRITEDATA, &data) must be called before curl_easy_perform(handle) In your program curl_easy_setopt(handle, CURLOPT_WRITEDATA, &data) is not called. If you uncomment g_print("%s", curl.get_data().c_str()) in timsms.cc, curl_easy_setopt(handle, CURLOPT_WRITEDATA, &data) will be called, but too late. writefunction() has already been called (when curl_easy_perform() was called), and probably with buffer==0. You must still change the call to Glib::ustring::append(). You can't use Glib::ustring::append(const char* src, size_type n) unless the data is purely 7-bit Ascii. And if it's neither 7-bit Ascii nor UTF-8 encoded Unicode, you should not use Glib::ustring. Kjell 2011-12-09 23:07, Spazzatura.Live skrev: I thought about it, but the problem is with the unreferencing of the Glib::ustring, not with the data (however if it tries to append a shorter string in a larger space it shouldn't be a problem, i think. (The matter could be if he tries to read more characters than the char * has allocated.)) Even if i try, in the "writefunction" to do anything else with the Glib::ustring it fails with segmentation fault. |