file transfering

Started by
8 comments, last by djsteffey 23 years, 6 months ago
can i do this and how should i go about it... i want to run a program. And when you run the program, I want the program to download a file off a web site....for example: i want to run the program then immediately download http://www.mySite.com/document.txt.......then i want to read this file into my program (which i know how to do)......do some computations (which i can do)......then save the file back to http://www.mySite.com/document.txt can i do this ? and if so how do i go about it ? "Now go away or I shall taunt you a second time" - Monty Python and the Holy Grail themGames Productions
Advertisement
CHttpFile
CFtpFile?

mfc stuff
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
The WinInet api is what you''re looking for. The CHttpFile and CFtpFile classes are MFC wrappers... WinInet is a very high level API relative to network communication, so you can skip MFC if you''re not already using it... you''ll end up with very similiar code.
do you know where i can get some info on WinInet ?


"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

For every API from M$, look in the MSDN. I don''t know if CHttpFile itself is able to upload something. Perhaps you should think about using FTP instead of HTTP.

Coder10000
ncsu121978,
If you want to use MFC, I have a couple of classes that wrap up the WinInet stuff. I can send them your way if your interested.

Or you''ll have to roll your own... If you go this route, you''ll need some info on how FTP works, grab the RFC for FTP and do some research, it isn''t too difficult. I''m sure that you can find a FTP Winsock class on the net as well.

Good Luck,

Dave "Dak Lozar"Loeser
Dave Dak Lozar Loeser
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."--anonymous
I used the WinInet functions and they worked really well for me and they were VERY easy to use. I think I made about 5 function calls and I could transfer the file.
1)Initialize a connection to the internet
2)initialize an ftp session
3) get the file
4)close the ftp session
5)close the internet connection

but thanks for the reply


"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

ncsu121978, Mind if I just call you C3P0? =)

If you wanna do http then do this. This requires winsock tcp/ip programming.

to download http://www.nothing.com/something.jpg do this

1. Connect to "www.nothing.com"
2. Send out "GET /something.jpg" to the server
3. Wait for data and place it in a buffer
4. When server disconnects, save the buffer to something.jpg

and you''re done.

---------------------------
No such thing as an innocent soul who lies to the world who he loves so much
you can call me whatever you like as long as you attempt to answer the questions........
thanks for the reply nes8bit but I have it working just like I want it to right now.

"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

This topic is closed to new replies.

Advertisement