Join us at IRC!
It is never to LATE to become what you never WERE.
Wednesday, May 23, 2012
Navigation
Members Online
Total Online: 28
Web Spiders: 14
Guests Online: 27
Members Online: 1

Registered Members: 70179
Newest Member: prankst3r
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

downloading files in c++

mastergamer
Member



Posts: 432
Location:
Joined: 07.02.06
Rank:
God
Posted on 07-03-06 20:49
I have just started learning c++. I have the Dev-c++ compiler. What code would I need to connect to a web/ftp server and download files?


mastergamer0168@gmail.com
Author

RE: downloading files in c++

BobbyB
Member



Posts: 260
Location: England
Joined: 16.03.05
Rank:
Monster
Posted on 07-03-06 20:51
Google beej's guide to sockets. It's invaluable.


Author

RE: downloading files in c++

wolfmankurd
Member



Posts: 1519
Location: UK
Joined: 30.05.05
Rank:
God
Posted on 07-03-06 21:03
In python this would do it.

#!/usr/bin/python
import urllib
url=raw_input('File to download: '
a=urllib.urlopen(url).read()
save=raw_input('Save as... ')
b=open(save, 'w')
b.write(a)
b.close()
a.close()


I expect its the same, basically open a webpage and read it, will do html just as it does .exe so long as .exe is saved as .exe and html as .html you'll be fine.


BY READING MY POST, YOU ACCEPT IT AS IS AND AGREE TO MY DISCLAIMER OF ALL WARRANTIES, EXPRESS OR IMPLIED, AS WELL AS DISCLAIMERS OF ALL LIABILITY, DIRECT, INDIRECT, CONSEQUENTIAL OR INCIDENTAL, THAT MAY ARISE FROM THE USE OF THIS (MIS)INFORMATION.


Widowmakr@hotmail.com http://LetsHackStuff.com
Author

RE: downloading files in c++

Zekasu
Member

Posts: 171
Location:
Joined: 31.12.05
Rank:
HBH Guru
Posted on 08-03-06 01:18
wolfmankurd wrote:
In python this would do it.

#!/usr/bin/python
import urllib
url=raw_input('File to download: '
a=urllib.urlopen(url).read()
save=raw_input('Save as... ')
b=open(save, 'w')
b.write(a)
b.close()
a.close()


I expect its the same, basically open a webpage and read it, will do html just as it does .exe so long as .exe is saved as .exe and html as .html you'll be fine.


Actually, it's the same, but with a lot more coding. For C++, you need to learn sockets, and I can vouch for Beej's guide. It's quite good.

Beej's Guide to Sockets
Guest
Username

Password

Remember Me


Bookmark This Page
Affiliates
Adverts

 

 

Links
By using, viewing or obtaining any information contained on this site, you agree to the disclaimer.

© HellBound Hackers 2008- 2009. Since 3rd December 2004.