0
vector<string> DownloadList()
{
LPCSTR site = "somesite.com/uploads/2/9/8/8/29880261/users.txt";
LPCSTR path = "C:\\Users\\Public\\Favorites\\users.txt";
URLDownloadToFile(NULL, site, path , 0, NULL);
ifstream file;
string line;
vector<string> lines;
file.open(path);
while (getline(file, line)) {
    lines.push_back(line);
}
file.close();
DeleteFileA(path);
return lines;
}

Even when the file is reuploaded to the site, the program downloads and reads the previous file? Does the old file get saved in memory or something? I dont get it. Old file is downloaded, though new one is uploaded and exists in the url. How do i get this fixed?

Nullptr
  • 221
  • 2
  • 5
  • 11

1 Answers1

4

This happens because the file is cached by the system. Use the API function DeleteUrlCacheEntry to delete the cached file (before calling URLDownloadToFile)

adjan
  • 13,371
  • 2
  • 31
  • 48