//下载图片的内容
//imgurls[i] 存放每一条图片 url路径
//image, 根据图片路径 进行http网页请求, image存放请求返回的内容
//byteread, 返回请求内容的大小
一下两句是什么意识, 请大神指导
const char * pos = strstr(p, "\r\n\r\n") + strlen("\r\n\r\n");//??
ofile.write(pos, byteRead - (pos - p));//??
我感觉是在请求返回的内容中,截取出图片内容,然后写入文件, 不明白是怎么截取的,为什么这样截取
if (GetHttpResponse(imgurls[i], image, byteRead)){
if (strlen(image) == 0) {
continue;
}
const char *p = image;
const char * pos = strstr(p, "\r\n\r\n") + strlen("\r\n\r\n");//??
int index = imgurls[i].find_last_of("/");
if (index != string::npos){
string imgname = imgurls[i].substr(index, imgurls[i].size());
ofstream ofile(foldname + imgname, ios::binary);
if (!ofile.is_open())
continue;
cout << g_ImgCnt++ << foldname + imgname << endl;
ofile.write(pos, byteRead - (pos - p));//??
ofile.close();
}