cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Callback progress function mess-up upload

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 3 Jan 2011 22:50:54 +0100 (CET)

On Mon, 3 Jan 2011, Dumitru Adrian wrote:

> int progres(void *clientp,double dltotal,double dlnow,double ultotal,double ulnow)                             
> {
>     SendMessage(baraprogres,PBM_SETPOS,(WPARAM)((ulnow/ultotal)*100),0);
>     return 1;
> }

It feels suitable to include a little quote here from the curl_easy_setopt man
page describing CURLOPT_PROGRESSFUNCTION:

   Returning a non-zero value from this callback will cause libcurl to abort
   the transfer and return CURLE_ABORTED_BY_CALLBACK.

>             res = curl_easy_perform(curl);
>             curl_easy_cleanup(curl);
>             curl_formfree(formpost);
>             MessageBox(hWnd,"fisier incarcat","info",MB_OK);

And it is *ALWAYS* a good idea to check the return code from a function,
especially when it doesn't do what you wanted it to do...

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-03