cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curlpp mailing list Archives

[cURLpp] page download crash - .net

From: HHHH <neworldemancer_at_gmail.com>
Date: Wed, 25 Feb 2009 22:13:26 +0300

Hello!

I have used libcurl in vs2005 for cpp applications and I'm happy:)

But when i started writing a service using .net technology some problems
aroused.

this is the source:

// this code is called from System::Threading::Thread

 std::vector<char> url(256);
 std::vector <char> ebuf(100);

 m_buf = new std::vector<char>;
 sprintf(&url[0], "ya.ru");
 int err = curl_global_init(CURL_GLOBAL_ALL);
 if(err) return -1;
 CURL * chnd = curl_easy_init();
 err = curl_easy_setopt(chnd, CURLOPT_ERRORBUFFER, &ebuf[0]);
 if(err) return -1;
 err = curl_easy_setopt(chnd, CURLOPT_WRITEFUNCTION, write_data);
 if(err) return -1;
 err = curl_easy_setopt(chnd, CURLOPT_URL, &url[0]);
 if(err) return -1;
 err = curl_easy_perform(chnd);

//callback function

size_t dataloader::write_data(void *buffer, size_t size, size_t nmemb, void
*userp){
  std::vector<char> buf(size*nmemb+bsize); //
    <<<<<<<----------------------------here in debugger i see that buffer
value is <undefined value>
 memcpy(&(buf)[bsize], buffer, size*nmemb); //
   <<<<<<<-----------------------------and here it crashes (read violation)
 return size*nmemb;
};

I think that it's because of /clr but anyway... is it possibly to use
libcurl in this case?

Thank You in advance,

with best regards

Mike

_______________________________________________
cURLpp mailing list
cURLpp_at_rrette.com
http://www.rrette.com/mailman/listinfo/curlpp
Received on 2009-02-25

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET