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

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

4

1 回答 1

4

发生这种情况是因为文件被系统缓存。使用API​​函数DeleteUrlCacheEntry删除缓存文件(调用前URLDownloadToFile

于 2015-05-04T18:29:57.123 回答