#include <iostream>
#include<stdio.h>
#include<urlmon.h>
#pragma comment(lib,"urlmon.lib")
BOOL FileExists(LPCTSTR lpszFileName){
DWORD dwAttributes=GetFileAttributes(lpszFileName);
if(dwAttributes==0xffffffff){
return false;
}
else{
return true;
}
}
void download(char* Url,char* FilePath){
if(FileExists(FilePath)){
if(!DeleteFile(FilePath)){
printf("檔案已存在,且無法洗掉");
}
}
URLDownloadToFileA(0,Url,FilePath,0,0);
if(FileExists(FilePath)){
printf("下載成功");
}
else{
printf("下載失敗");
}
}
int main(int argc,char* argv[]){
// if(argc!=3){
// printf("請輸入:鏈接 存放地址 ");
// }
// else{
download(argv[1],argv[2]);
// }
return 0;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/95562.html
標籤:安全技術/病毒
上一篇:求。求助
下一篇:關于網站后臺管理的問題
