Re: Get Download Status; C++; IdFTPClient

Giganews Newsgroups
Subject: Re: Get Download Status; C++; IdFTPClient
Posted by:  Remy Lebeau (TeamB) (
Date: Wed, 7 Sep 2005

"Joe Pool" <jpo…> wrote in message

> How can I determine the progress of a download (i.e. to
> update a Progress Bar)?

Use the OnWork events.

>  TIdFTPListItem* Item = new TIdFTPListItem(NULL);
>      Item = IdFtp1->DirectoryListing->Items[i++];

That is a memory leak.  You are allocating a new object that you never use.
The first time the loop executes, you are re-assigning the pointer value to
pointer to another object, thus losing the pointer to the memory you

>        FileStream = new TFileStream("C:\setup.exe", fmCreate |
> fmShareDenyWrite);

You are missing a slash in the filename.  You must always escape forward
slashes in string/character literals:

    FileStream = new TFileStream("C:\\setup.exe", fmCreate |

>        i = IdFtp1->DirectoryListing->Count + 1;  // forces to exit the

Use a 'break' statement instead to exit the loop.




In response to

Get Download Status; C++; IdFTPClient posted by Joe Pool on Wed, 7 Sep 2005