samedi 29 novembre 2014

problem with downloading images using URLDownloadToFile in vc++


the following function is taking a list of urls of images as parameter in the form of vector and the function i have used to download files is "URLDownloadToFile" but not a single time the images are downloaded.


always same results "Unknown error" so any help will be appreciable . thank you in advance #



void fun::update(vector<std::string>& list_url)
{

vector<std::string> res ;

HRESULT hr;
for(std::size_t i=0;i< list_url.size();i++)
{
res.push_back(list_url[i].substr( list_url[i].find_last_of("/") + 1 ));


LPCTSTR Url = (LPCTSTR)list_url[i].c_str();
LPCTSTR File =(LPCTSTR)res[i].c_str();


hr = URLDownloadToFile(0, Url,File , 0, 0);


switch (hr)
{
case S_OK:
cout << "Successful download\n";
break;
case E_OUTOFMEMORY:
cout << "Out of memory error\n";
break;
case INET_E_DOWNLOAD_FAILURE:
cout << "Cannot access server data\n";
break;
default:
cout << "Unknown error\n";
break;
}
}

}


the function " URLDownloadToFile(0, Url,File , 0, 0)" is responsible for downloading files





Aucun commentaire:

Enregistrer un commentaire