cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Unhandled exception whenusingcurl_easy_perform()inVisualStudio2005 on Windows XP.

From: Nathan E. Moore <nate_at_redtetrahedron.org>
Date: Wed, 04 Jun 2008 08:54:57 -0400

--On Wednesday, June 04, 2008 4:30 PM +0800 Xu Xiaogang-a19881
<nickxu_at_motorola.com> wrote:
>
> CURLcode setPostField(string post_content)
> {
> CURLcode errornum;
> errornum = curl_easy_setopt (curl, CURLOPT_POSTFIELDS,
> post_content.c_str());
>
> if (errornum != CURLE_OK)
> {
> throw curl_easy_strerror(errornum);
> }
>
> return CURLE_OK;
> }
>

With the current version your problem is here. The CURLOPT_POSTFIELDS
option does NOT copy the buffer. You should try switching to
CURLOPT_COPYPOSTFIELDS as it does copy the data.

Nathan Moore
Received on 2008-06-04