Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can a FILE point to a FTP file?

Status
Not open for further replies.

Insider1984

Technical User
Feb 15, 2002
132
US
I'm playing with a program that allows on the fly javascript writing using various dialogs etc (nothing fancy). It works great but now I would like it to grab the file from ftp and then redownload it.

I was thinking that the OS would handle going out to grab the file (isn't this why MS illegally bundles IE into it's OS?) as long as I had something like:

Code:
FILE *html;
CString filename = "ftp://username:password@ftp.2khappy.com/public/test.html";
fopen(html,"r");



well as most people might assume... this didn't work... any easy way to do this?
 
could a sent a command via command prompt commands?

1. "ftp"
2. "open ftp.2khappy.com/public/test/"
3. "username"
4. "password"
5. "get test.html c:/temp/test.html"

then when done redo above except use:

"binary"
"send C:\temp\test.html"

wishful thinking?
 
Try using InternetOpen(), InternetConnect() and FTPGetFile()and other APIs.
Things should workout.

Cheers,
Jayashree Rama Rao
 
Since the functions like InternetOpen work only where wininet.dll is present which is not included in typical windows installation.
This can also be done using sockets, read the rfc for ftp protocol. open the data socket and upload or download the file via data socket.

Rahul If you think you can't do it,You will never be able to do it.
 
>>"wininet.dll ... is not included in typical windows installation."

Are you sure? It's on every machine I've ever worked on and that includes 98, xp, NT, and 2000 machines

 
I have a fresh windows 95 machine, i have recently installed it. And it doesn't have wininet.dll, that's why my application failed on win 95. If you think you can't do it,You will never be able to do it.
 
I have a fresh windows 95 machine, i have recently installed it. And it doesn't have wininet.dll, that's why my application failed on win 95.

Rahul If you think you can't do it,You will never be able to do it.
 
win 95?! well then yeah, I guess you would have to do it with sockets...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top