C++中用Find链接网页分离???
这段代码的意思是分离出:中国黄页上网的链接。代码没有错误,就是不明白这里的.Find(_T());这个东西怎么用?是什么?帮忙解析一下。。谢谢啊。非常感谢啊。。。。
int pospage = m_HtmlSrc.Find(_T("公司名称及信息查询"),pospage);
if ( pospage == -1 )
{
return -1;
}
if ( ( pospage = m_HtmlSrc.Find(_T("下面是匹配的最前面400条记
录"),pospage) ) != -1 )
{
m_nPageCount = 20;
return 20;
}
else
{
//共<b>
pospage = m_HtmlSrc.Find(_T("共<b>"),pospage);
if( pospage == -1)
return -1;
i=0;
int jj = 0;
while( m_HtmlSrc[pospage+i+5]!='<' )
{
if ( ( (int)m_HtmlSrc[pospage+i+8] < 58 )&&((int)
m_HtmlSrc[pospage+i+8] > 47) )
{
temp.Insert(jj,m_HtmlSrc[pospage+i+8]);
i++;
jj++;
}
else
{
i++;
}
}
}
pagecnt = atoi(temp.GetBuffer(temp.GetLength()));
pagecnt = pagecnt/20;
m_nPageCount = pagecnt;
return pagecnt;
}
还有一段代码:分离 sohu 一级页面内的该查询的网页链接数目。问的也是同样的问题。Find那里不懂。。。急需要人帮忙。。。
int CQueryCompany::AppartUrlSohu()
{
int pospagecnt = 0,pagecnt;
CString temp;
// 得到页面总数
if ( ( pospagecnt = m_HtmlSrc.Find(_T("<TD width=190><FONT color=#FFFFFF>"),pospagecnt) ) == -1 )
{
return pospagecnt;
}
if (( pospagecnt = m_HtmlSrc.Find( _T("条"),pospagecnt)) == -1 )
{
return pospagecnt;
}
int i=0;
int j=0;
while (1)
{
if ( ( (int)m_HtmlSrc[pospagecnt+i] < 58 )&&((int)m_HtmlSrc[pospagecnt+i] > 47) ) // 47-58 为数字
{
temp.Insert(j,m_HtmlSrc[pospagecnt+i]);
i++;
j++;
}
else
{
i++;
}
if(i>10) // 最大为8位数
break;
}
pagecnt = atoi(temp.GetBuffer(temp.GetLength())); // 转化为整型
return pagecnt;
}