meaing of below code
-
please tell me what is going on in below code
if(curl)
{
curl_easy_setopt(curl,CURLOPT_URL,url.c_str());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&ret);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,WriteFunction);
CURLcode res = curl_easy_perform(curl);
if(res != CURLE_OK)
{
curl_easy_cleanup(curl);
return 0;
}
curl_easy_cleanup(curl);
if(ret.find("Ok"))
{
char* r=new char[ret.length()+1];
strcpy(r,ret.c_str());
char* p=strtok(r,"|");
p=strtok(NULL,"|");
return atoi(p);
}
}
return 1;
} -
please tell me what is going on in below code
if(curl)
{
curl_easy_setopt(curl,CURLOPT_URL,url.c_str());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&ret);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,WriteFunction);
CURLcode res = curl_easy_perform(curl);
if(res != CURLE_OK)
{
curl_easy_cleanup(curl);
return 0;
}
curl_easy_cleanup(curl);
if(ret.find("Ok"))
{
char* r=new char[ret.length()+1];
strcpy(r,ret.c_str());
char* p=strtok(r,"|");
p=strtok(NULL,"|");
return atoi(p);
}
}
return 1;
} -
please tell me what is going on in below code
if(curl)
{
curl_easy_setopt(curl,CURLOPT_URL,url.c_str());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&ret);
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,WriteFunction);
CURLcode res = curl_easy_perform(curl);
if(res != CURLE_OK)
{
curl_easy_cleanup(curl);
return 0;
}
curl_easy_cleanup(curl);
if(ret.find("Ok"))
{
char* r=new char[ret.length()+1];
strcpy(r,ret.c_str());
char* p=strtok(r,"|");
p=strtok(NULL,"|");
return atoi(p);
}
}
return 1;
}See: [curl](https://curl.haxx.se/) [libcurl - curl_easy_setopt()](https://curl.haxx.se/libcurl/c/curl\_easy\_setopt.html) And BTW, you again posted in the wrong forum. This code looks like the native C++.