0

I am making a program that downloads files to a windows. To do so i used urlmon and the urldownload to file function. Whenever i download a file with the function in question in my windows i only get a prefetch file, but i can't find the file on my hard drive. Please tell me what i am doing wrong?

#include <windows.h>
#include <stdio.h>

typedef HRESULT (WINAPI *UDTF)(LPVOID, LPCTSTR, LPCTSTR, DWORD, LPVOID);

int dl_url(char *url, char *path)
{
    int q = 1;
    HMODULE hDll;
    UDTF URLDownloadToFile;

    if((hDll = LoadLibrary("urlmon")))
    {
        if((URLDownloadToFile = (UDTF)GetProcAddress(hDll, "URLDownloadToFileA")))
        {
            if(URLDownloadToFile(0, url, path, 0, 0) == 0)
            q = 0;
        }
        FreeLibrary(hDll);
    }

    return q;
}

Note: I use a 32 bit windows xp to test this program.

p4p1
  • 31
  • 5
  • There are folders in your project directory called "Release" and "Debug", that's where your *.exe is file is at. Look in those directories. Or give full path name for "path". Also your style of programming is wrong. Turn on compiler warning to level 4. – Barmak Shemirani Jun 24 '16 at 20:35
  • I do not have any Release nor Debug directory in my file project. To compile this i use minwg on ubuntu and i transfer the file over on my windows xp using a local webserver. And i did give a full name to path but still no result. And the link is correct to. – p4p1 Jun 25 '16 at 07:38

0 Answers0