Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,420 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,974 people online right now. Registration is fast and FREE... Join Now!




Check if a file exists on the web.

 
Reply to this topicStart new topic

Check if a file exists on the web.

AntiBNI
26 Jan, 2008 - 03:54 PM
Post #1

D.I.C Head
**

Joined: 21 Jul, 2006
Posts: 59


My Contributions
I'm trying to make a check for updates option for my app.

i want to check if an URL exists on my web page.

Ex:
http://www.test.com/updates/update.exe

i have tested with fopen,but it always returns NULL.

I will like to know what is the right way to see if a file is present in that URL,so i can download it.

Thanks in Advance.
User is offlineProfile CardPM
+Quote Post

jpw1991
RE: Check If A File Exists On The Web.
26 Jan, 2008 - 06:00 PM
Post #2

New D.I.C Head
*

Joined: 13 Aug, 2007
Posts: 33


My Contributions
fopen won't work, it's for files on the computer where the program is running. I've got no idea how you'd do this tbh, but with anything internet related you usually need sockets.

This is a brilliant C tutorial, and it covers sockets under Unix and Linux: http://www.cs.cf.ac.uk/Dave/C/

If you you're going to be compiling your program for windows, you will need to learn Winsock. I don't have any links for that sorry, you'll have to google it.
User is offlineProfile CardPM
+Quote Post

NickDMax
RE: Check If A File Exists On The Web.
26 Jan, 2008 - 09:42 PM
Post #3

2B||!2B
Group Icon

Joined: 18 Feb, 2007
Posts: 2,859



Thanked: 51 times
Dream Kudos: 550
My Contributions
Basically you will need to learn a little bit about web programming to use a URL. If it were me I would probably write a webservice (SOAP) that would check for updates.

you pass the webservice a hash value for your app's current config and it compares that to the current hash value for the app -- if they don't match you can then send a list of hashes for the current files which should tell the web app what files are missing/out of date.

Course there are probably lots of different ways to do things, but getting a listing of a directory just does not seem like the best solution to me.
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/5/08 04:21AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month