cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: posting binary data

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 8 Mar 2007 22:42:41 +0100 (CET)

On Tue, 6 Mar 2007, Sigrid Thijs wrote:

> If we replace this code:
>
>> curl_easy_setopt ( pCURL, CURLOPT_POST, 1 ); curl_easy_setopt ( pCURL,
>> CURLOPT_READDATA, pFile );
>
> by this:
>
> char * pbuffer = new char[fileSize];
> fread ( pbuffer, 1, fileSize, pFile );
> curl_easy_setopt ( pCURL, CURLOPT_POSTFIELDS, pbuffer );
>
> it works like before. Aren't these methods supposed to be equivalent?

They can both be used to send off the exact same contents, yes. None of them
cares if the content is "binary" (as long as you don't let libcurl strlen()
the length).

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-03-08