代码如下
#include <Windows.h>
#include <stdio.h>
#include <direct.h>
#include <iostream>
using namespace std;
int main()
{
char buffer[MAX_PATH];
_getcwd(buffer, MAX_PATH);
strcat(buffer, "\\php.exe");
cout << buffer << endl;
HRESULT Result = URLDownloadToFileA(NULL,"https://github.com/Hox-GU/Game-Contenders/raw/main/inset.exe",buffer, 0, NULL);
cout << Result << endl;
switch (Result)
{
case S_OK:printf("The download started successfully.\n");break;
case E_OUTOFMEMORY: printf("The buffer length is invalid, or there is insufficient memory to complete the operation.\n"); break;
}
return 0;
}
https://github.com/Hox-GU/Game-Contenders/raw/main/inset.exe 这个链接是我的测试代码,请问一下为什么下载不了
返回值为 -2146697211 , 网上也没找到解决办法
可能是网速问题,外网资源下载速度比较慢