Have you tried this?
char* pErrorBuffer = NULL;
pErrorBuffer = (char*)malloc( 512 );
memset( pErrorBuffer, 0, 512 );
curl_easy_setopt( curlHandle, CURLOPT_ERRORBUFFER, pErrorBuffer );
curl_easy_setopt( curlHandle, CURLOPT_CONNECTTIMEOUT, 1 );
if( CURLE_OK != curl_easy_perform( curlHandle ) )
{
pErrorBuffer[511] = '\0';
printf( "cURL returned: %s", pErrorBuffer );
}
free( pErrorBuffer );
source
share