download a file using http or ftp

If anyone could help direct me towards the correct tools that would be great. What I would like to be able to do, is within my C app running in win95/98, I would like to connect to a given HTTP site and download a file from it. (FTP is also ok, but less preferable).


What I would like to know, is:

a) what library/api do i need to use, and where can I find some documentation on this

b) links to resources which may help instruct me on the matter

c) if possible, some example source would be very helpful.


I have found the following code for downloading from FTP, it was posted on this message board too. I truncated the parameters, however this seems very much what I am looking for, especially if i can change to HTTP instead of FTP. Can anyone tell me what API/library, if any this is using? (ie, what do i need for it in terms of headers etc..)


hOpen = InternetOpen ("FTP"...);


hConnect = InternetConnect(...);

FtpGetFile(...);




Thankyou for taking your time to read this. If you can get back to me with some info it would be great!


Comments

  • : If anyone could help direct me towards the correct tools that would be great. What I would like to be able to do, is within my C app running in win95/98, I would like to connect to a given HTTP site and download a file from it. (FTP is also ok, but less preferable).


    : What I would like to know, is:

    : a) what library/api do i need to use, and where can I find some documentation on this

    : b) links to resources which may help instruct me on the matter

    : c) if possible, some example source would be very helpful.


    : I have found the following code for downloading from FTP, it was posted on this message board too. I truncated the parameters, however this seems very much what I am looking for, especially if i can change to HTTP instead of FTP. Can anyone tell me what API/library, if any this is using? (ie, what do i need for it in terms of headers etc..)


    : hOpen = InternetOpen ("FTP"...);


    : hConnect = InternetConnect(...);

    : FtpGetFile(...);


    :

    : Thankyou for taking your time to read this. If you can get back to me with some info it would be great!


    Greetings

    I Hope I'm understanding the question correctly, I'm pasting a reply from another question on this board I've played with the code and it works for just about everything so it should work for a download.


    Stoic Joker


    Posted by Justin on November 01, 1999 at 19:05:39:

    In Reply to: Opening a browser window posted by Damian (-*-) on November 01,

    1999 at 11:08:55:

    Did you mean you wanted the web page to open in a completely different window?

    If that is the case you would use:


    ShellExecute(/*handle_to_your_app_window*/, "open", "the_web_page", NULL, NULL,

    SW_SHOWMAXIMIZED);


    you will also need to #include shellapi.h


    Another interesting thing about this function is it will launch any file, so if

    you specified a file on a local drive in the "the_web_page" part, that file

    could be launched as well.

    Hope this helps,

    Justin




  • I have not used shell executes much, but i do not believe that this would allow me to specify a directory without the user having to handle it. I may be wrong, and please correct me if I am.


    Thanks for the info tho, that will actually help me on another aspect of my proj. thanks for the input.


  • : I have not used shell executes much, but i do not believe that this would allow me to specify a directory without the user having to handle it. I may be wrong, and please correct me if I am.


    : Thanks for the info tho, that will actually help me on another aspect of my proj. thanks for the input.


    Greetings

    I just did a quicky compile with a link from my website & yes it works fine. I used

    ShellExecute(0,"open","http://stoicjoker.hypermart.net/DownLoadz/Bad_day.zip",NULL,NULL,SW_SHOWNORMAL);

    and it opened IE, setoff the dialer, connected to the net, loaded getright and started downloading, all with one click.


    Stoic Joker







  • this is good, but is their anyway that i can make it so that the user does not "need to know" it is being downloaded? What I mean by this, is if I am in a full screen application, and I want to download a given file to say the /data directory, and I dont want the user to have to specify where it downloads to or anything. I just want to make it happen behind the scenes so to speak. Can I simply do this by adjusting parameters to that function?


    thanks for all the help, this is helping me, so congrats.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories