// DownloadURL.cpp : Download the contents of URLs to a file.
//

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

int main(int argc, char* argv[])
{
    printf("DownloadURL v1.0\n Copyright (C) David McCabe, 2001.\n\n");
    if (argc < 3)
    {
        printf("Usage: DownloadURL url file\n");
        return 1;
    }

    CoInitialize(NULL);
    if (FAILED(URLDownloadToFile(NULL, argv[1], argv[2], 0, NULL)))
    {
        printf("Download failed!\n");
        return 2;
    }
    return 0;
}