cURL / Mailing Lists / curl-library / Single Mail


Re: Curl Multi Problem.

From: Surya Kiran Gullapalli <>
Date: Mon, 6 Aug 2007 15:41:05 +0530

> The docs for CURLOPT_URL say: "The string must remain present until curl no
> longer needs it, as it doesn't copy the string."
> However, when you call os.str(), a temporary string object is created by
> the C++ compiler, and c_str() returns a pointer to its contents. Once the
> curl_easy_setopt() call returns, the temporary object is destroyed, so you
> are left with a dangling pointer to the URL.

Does that mean, I cannot use std::string or std:stringstream at all?

If the answer is no, then how can i modify my program ?
I do not know upfront, how many web pages i wanted to download. That
will be decided at run time and I want to use vector<string> for this.

Received on 2007-08-06