cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curlpp mailing list Archives

Re: [cURLpp] curlpp problem

From: Jean-Philippe Barrette-LaPierre <jean-philippe.barrette-lapierre_at_savoirfairelinux.com>
Date: Sat, 31 Dec 2005 13:57:12 -0500

On December 29, 2005 11:53 pm, Jacky Luk wrote:
> Error:
> Webcam.cpp:428: instantiated from here
> /usr/local/include/utilspp/functor/FunctorHandler.hpp: 50: error: two few
> arguments to function
>
> Very peculiar. Is my library not installed correctly or even breaking?
>

No, you simply don't have the right function signature.

> size_t write_data1 (void *buf, size_t size, size_t nmemb, FILE *FileStream)
> {
> }

in fact, if you check in Types.hpp you'll see that WriteFunctionFunctor is
defined as this:

typedef utilspp::Functor<
      size_t,
      TYPE_LIST_3(char*, size_t, size_t) > WriteFunctionFunctor;

Meaning that the function returns a size_t, and the parameters are this:
(char*, size_t, size_t)

so, you need to provide a function that respect that signature. Your problem
is that you need a FILE* to be passed to your function. The original
signature for libcURL write function is:

size_t (char *, size_t, size_t, void *)

the last pointer is provided for the library's user. You can pass some
user-arguments. The problem with this, is that it's not type safe. When I
decided to add the exception safe feature, I decided to oblige users to use
functors (might have been a bad idea, but I'll check that later). The way to
pass user data to the function with functors, is to "bind" arguments to
functors. You could use utilspp::BindFirst function to do so. However,
currently there's a problem with it, so you cannot use it. I'm working on an
example for this (example10.cpp, not yet available).

So, you can use the old way to do it, but it won't be exception safe. I did an
example11.cpp for that, but it's not yet available. I attached the example to
this email.

-- 
Jean-Philippe Barrette-LaPierre
Coder in wonderland
(try lisp and you'll see the light)


_______________________________________________
cURLpp mailing list
cURLpp_at_rrette.com
http://www.rrette.com/mailman/listinfo/curlpp

Received on 2005-12-31

These mail archives are generated by hypermail.

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

File upload with ASP.NET