cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLFORM_BUFFER

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 24 Jun 2002 16:17:44 +0200 (MET DST)

On Mon, 24 Jun 2002, Andrés García wrote:

> > They should already be possible to use as such. In fact, the man page is
> > outdated on that subject as *all* options except the CURLFORM_ARRAY
> > itself are possible to use in an CURLFORM_ARRAY (since 7.9.6).
>
> Yes, I know that, it was a most welcome change as far as I am concerned,
> but the problem I see is with CURLFORM_BUFFERLENGTH, the value is an
> integer while the curl_forms struct expects the value to be a char pointer.
>
> Is there a way around it using casts or something?

Yes, you just have to case that long value to a char *. Like this:

 struct curl_forms array[2];

 array[0].option = CURLFORM_BUFFERLENGTH;
 array[0].value = (char *)120;
 array[1].option = CURLFORM_END;

I agree this isn't the nicest code known to mankind, but then again, what is?
;-)

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
Received on 2002-06-24