|
-
April 6th, 1999, 07:37 AM
#1
MFC CFtpConnection class and download status.
Hi EveryOne,
I need to code a FTP client.
I am using the following classes. CInternetSession, CFtpConnection, CInternetFile.
I need to get the download size status as I need to display the Total file size, Down load rate, Time left etc.
How do I get these figures?
The code Slice I'm working with is.
////////////////////////////////////////
FILE * myfile;
char buf[16];
int count;
CInternetSession mySession("test1");
CFtpConnection * myFtpConnection = mySession.GetFtpConnection("whtorcl","c2032","2032",21,FALSE );
myFtpConnection->SetCurrentDirectory("c2001");
CFtpFileFind myFtpFileFind(myFtpConnection,1);
myFtpFileFind.FindFile("extract.dat");
CInternetFile* iFile = myFtpConnection->OpenFile( "doc.txt",GENERIC_READ, FTP_TRANSFER_TYPE_ASCII,1);
myfile = fopen("download.txt","w");
// Get the file size somehow!! ( ? )
// In the loop here keep track of the size downloaded!! ( ? )
while( (count = (File->Read( (void* ) buf, 16) ))== 16)
fprintf(myfile,"%s",buf);
fclose(myfile);
AfxMessageBox("Down Load complete");
////////////////////////////////////////
Warm Regards,
Vijay
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|