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
[email protected]
http://www.rrette.com/mailman/listinfo/curlpp

Reply via email to