本文整理汇总了C++中CUrl::get_response_code方法的典型用法代码示例。如果您正苦于以下问题:C++ CUrl::get_response_code方法的具体用法?C++ CUrl::get_response_code怎么用?C++ CUrl::get_response_code使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUrl
的用法示例。
在下文中一共展示了CUrl::get_response_code方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: call_wirte_func
/*
* 将请求返回的结果打印输出到屏幕.
*/
long CUrl::call_wirte_func(void *buffer, int size, int nmemb, void *uri)
{
long count = size * nmemb;
Uri *puri = (Uri *)uri;
CUrl *pcurl = (CUrl *)puri->pcurl;
if (pcurl != 0 && pcurl->isfirstwirte == true)
{
pcurl->get_response_code();
pcurl->get_response_length();
pcurl->get_response_contenttype();
puri->request_size = pcurl->request_size;
puri->request_cursize = 0;
}
if (pcurl->request_size > 0)
{
if (puri->curbuf == NULL)
{
puri->curbuf = (char *)malloc(pcurl->request_size+1);
}
memcpy(puri->curbuf + puri->request_cursize,(const char *)buffer, count);
puri->request_cursize += count;
//puri->curbuf_allocsize = pcurl->request_size;
puri->curbuf_size += count;
puri->curbuf[puri->request_size] = 0;
}
else
{
if (puri->curbuf == NULL)
{
puri->curbuf = (char *)malloc(count+1);
memcpy(puri->curbuf, buffer, count);
puri->request_cursize = count;
puri->request_size = count;
//puri->curbuf_allocsize = count;
puri->curbuf_size = count;
}
else
{
puri->curbuf = (char *)realloc(puri->curbuf, puri->request_size + count+1);
memcpy(puri->curbuf + puri->request_size , buffer, count);
puri->request_cursize += count;
puri->request_size += count;
//puri->curbuf_allocsize += count;
puri->curbuf_size += count;
}
puri->curbuf[puri->request_size] = 0;
}
pcurl->isfirstwirte = false;
return count;
}