I'm trying to download zip files from the internet using URLDownload But i get an output of 104 ASCII h but it doesn't download anything at all I tried using a vector but got an error saying doesn't match type const wchar_t*
Also what method would i go about finding a users username and saving it to there desktop for other people who decide to use my program. I want to create an installer for windows programs.
So that if i ever mess up my PC. I can run my script and download everything.
Another thing. Is there a way to create some kind of list of URLs to download without constantly having to enter a url. This is one reason i am using a class. So i can download multiple files.
Here is my code:
#include <windows.h>
#include <iostream>
#include <cstdio>
#include <vector>
namespace web {
class Downloader {
public:
const wchar_t* URL;
const wchar_t* dest;
};
}
int main()
{
web::Downloader download;
web::Downloader* file{ &download };
file->URL = L"https://github.com/Sycnex/Windows10Debloater/archive/refs/heads/master.zip";
file->dest = L"C:\\Users\\file.zip";
if (S_OK == URLDownloadToFileW(NULL, file->URL, file->dest, 0, NULL)) {
std::cout << "Downloading file : " << *file->URL;
return 0;
}
else {
std::cout << "err: " << *file->URL;
return 1;
}
return 0;
}