Follow us on Twitter!
Things are more like they are now than they have ever been before. - Dwight D. Eisenhower
Monday, April 21, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 31
Guests Online: 28
Members Online: 3

Registered Members: 82858
Newest Member: alexxkim
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

downloading files in c++


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
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?


Author

RE: downloading files in c++


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 07-03-06 20:51
Google beej's guide to sockets. It's invaluable.


Author

RE: downloading files in c++


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 07-03-06 21:03
In python this would do it.
Code

#!/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.


Author

RE: downloading files in c++


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 08-03-06 01:18
wolfmankurd wrote:
In python this would do it.
Code

#!/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