Advertisement Jump to content


This topic is now archived and is closed to further replies.

Guest Anonymous Poster

Checking server for a file

This topic is 7033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

strange how i was just learning how to do the same thing =)

anyway, you can use the WinInet functions, which are pretty simple to use. first you have to create an internet handle, which is used to create everything else. after that, you connect to a specific site and file, then you can read the file. here's code:

HINTERNET hInet = InternetOpen("name of this program", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
HINTERNET hConnect = InternetOpenUrl(hInet, "", NULL, 0, 0, 0);

// read the file and write it somewhere
int fSave = _open("data.sav", _O_BINARY | _O_WRONLY | _O_CREAT, _S_IWRITE);

BYTE buff[1024];
DWORD dwRead;
while (InternetReadFile(hConnect, buff, 1024, &dwRead))
if (dwRead == 0)
_write(fSave, buff, dwRead);

hope that helps =) it also works with ftp. oh, and that string with "name of this program" can really be anything, i think it gets passed onto the server and can be used to profile the visitors, not sure on that however. you also have to include "wininet.h" and link to "wininet.lib"


[This message has been edited by mutex (edited October 17, 1999).]

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Does anyone know how to check a server for a specific file? I have the address of the server, but I don't know the code to check the server for a file. In case you don't understand here's an example. I want to check the server for the file named "BLABLA.BLA", how do I do this? Or what if I only have the IP address of this server?

Thanks in advance

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!