C++ WinAPI URLDownloadToFile (urlmon) 错误

C++ WinAPI URLDownloadToFile (urlmon) bug

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;
}

即使将文件重新上传到站点,程序也会下载并读取之前的文件?旧文件是否保存在内存中或其他东西中?我不明白。旧文件已下载,但新文件已上传并存在于 url 中。我该如何解决这个问题?

出现这种情况是因为文件被系统缓存了。使用API函数DeleteUrlCacheEntry删除缓存文件(在调用URLDownloadToFile之前)