Alle 10:36, marted́ 2 novembre 2004, Phani Kumar Anumolu ha scritto: > Dear Wget Users, > I am a newbie interestd in C socket programming. > I would like to get a single file from the URL given, that URL must be > passed as an input to my program, and that program should automatically > retrive that file from the URL given. My requirement is NOT towards > handling all the complexities which are addressed in WGET. > Can some body send me a sample code with which I can download a single file > from the URL given. I am writing in C and tried to understand Wget..which > looked very complicated. > Any further suggestion are appreciated.
why are you using C for URL retrieval? it is a very complex task to perform in C (definitely not for newbies) and it is completely useless to understand how the socket api works. if you want to retrieve an URL from the internet the best choice would probably be python: #!/usr/bin/env python import urllib (name, header) = urllib.urlretrieve("http://www.python.org/doc/2.3.4/lib/module-urllib.html") or perl with libwww: #!/usr/bin/perl -w use LWP::Simple; $url = 'http://www.python.org/doc/2.3.4/lib/module-urllib.html'; $content = get $url; die "Couldn't get $url" unless defined $content; please notice that the examples above are working but not complete. anyway, i would recommend you to learn how the socket api works in python or perl before messing with the C socket api, which is much more complex. -- Aequam memento rebus in arduis servare mentem... Mauro Tortonesi University of Ferrara - Dept. of Eng. http://www.ing.unife.it Institute of Human & Machine Cognition http://www.ihmc.us Deep Space 6 - IPv6 for Linux http://www.deepspace6.net Ferrara Linux User Group http://www.ferrara.linux.it