|
|
很无聊的东西,那文档好像是vb2005的,忘得差不多了,看不懂。
下面我写的应该没什么问题吧?
// TODO: Add your control notification handler code here
UpdateData();
CFile fil;
fil.Open(m_htm,CFile::modeRead);//打开htm文件
char*buf=new char[fil.GetLength()+1];
ZeroMemory(buf,fil.GetLength()+1);
fil.ReadHuge(buf,fil.GetLength());//读取整个文件到内存
CString str;
str=buf;
CFile fil2;
fil2.Open(m_list,CFile::modeWrite|CFile::modeCreate);
str.MakeLower();//转换成小写
int i=0,j=0,k=0,l=0;
while(1)
{
i=str.Find("http://",j);
j=str.Find(".jpg",i);
k=str.Find("\"",i);
l=str.Find("'",i);//查找http://后的第一个引号
if(l<k&&l>-1)k=l;
if(k<j)
{
j=k+1;
continue;
}//找到的引号在.jpg的前面,这次不算
if(i!=-1)//如果找到
{
CString str2;
str2=str.Mid(i,j+4-i)+"\r\n";//提取的链接
fil2.Write(str2,str2.GetLength());
}
else
{
break;
}
}
fil.Close();
fil2.Close(); |
|