All pastes #503378 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-05-22 21:11 UTC
rendered paste body
////////////////////////////////////////////////
////////////////////////////////////////////////
//    Basic Web Downloader created by Ice_Dragon    
//    Thanks to Pal the help :D                    
//                                                
//    - Email - Ice_Dragon@Eof-Project.net        
//    - MSN   - Ice_Dragon@ssgroup.org            
////////////////////////////////////////////////
////////////////////////////////////////////////


#include <iostream.h>
#include <urlmon.h>
#pragma comment(lib, "urlmon.lib")
#include <fstream>

bool FileExists (const char *fname)
{
if(std::ifstream(fname)!=NULL)
{
return true;
}
else
{
return false;
}
}

int main ()
{

char arg1[100];
char arg2[50];
char ans[5];

        cout<< "Basic Web Downloader created by Ice_Dragon.\n Thanks to Pal for the help.\n http://SSgroup.org\n\n\n\n\n";


        cout<<"Please Enter URL to Download From E.g [http://site.com/file.txt]";

cout<<endl;
    cin >> arg1;

        cout<<endl;
        cout<<"Please Enter DIR to save to E.g [C:\\file.txt] ";

cout<<endl;
    cin >> arg2;

  URLDownloadToFile(NULL,arg1,arg2,NULL,NULL);

if(FileExists(arg2))
{
        cout<<"File Downloaded.\n\n";

        cout<<"Do You Wish To Execute The File?\n";
        cin >> ans;
            if (ans == "yes")
            {

        cout<<"Executing Downloaded File\n\n";

  ShellExecute(0,"open",arg2,0,0,SW_NORMAL);
            }
}


else
{
        cout<<"Failed To Download File\n";
return 0;
}
}