Retrieving response text from curl in cpp
<p>we need to receive response string from curl in CPP ,I tried following options but nothing worked.js uses xhr.responseText for this.I need to do in cpp.</p>

<pre><code> static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
    size_t realsize = size * nmemb;
    const char* sp = static_cast&lt;const char*&gt;(contents);
    readBuffer.append(sp, realsize);
    return realsize;
 }

CURLcode res;
char* http_error= new char[100];

readBuffer.clear();
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &amp;readBuffer);
CURLcode code(CURLE_FAILED_INIT);
code = curl_easy_perform(curl);
cout &lt;&lt;  "Curl response msg CURLOPT_WRITEDATA: "&lt;&lt;curl_easy_strerror(code)&lt;&lt; " respose :"&lt;&lt;readBuffer;


res=curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &amp;http_code) ;
cout &lt;&lt;  "Curl response msg: "&lt;&lt; curl_easy_strerror(res);
</code></pre>