• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3670
  • Last Modified:

Indy TIdFTP Client Example in CPP?

Dear All,

Has anyone seen and example of implementing an Indy FTP client in Borland C++ Builder? Preferably with special reference to using the Intercept and TIdLogEvent?

I've gone through Delphi examples, and just can't match them to C++ (such as when assigning a procedure to the TIdLogEvent->OnReceived handler I get the magnificent error:
[BCC32 Error] Comms.cpp(31): E2034 Cannot convert 'TLogItemDataEvent' to 'TLogItemDataEvent'). I can go into gory detail, but before embarking on it I thought I'd ask the question if anyone had access to such a demo.

Thanks

JB

All help gratefully received.
0
prunesquallor
Asked:
prunesquallor
  • 2
1 Solution
 
Morris_SzyslakCommented:
I don't have any problems. I use Indy10.5.5
Maybe this is useful for you?
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
TIdFTP *IdFTP1 = new TIdFTP(this);
TIdLogEvent *IdLogEvent1 = new TIdLogEvent(this);
IdLogEvent1->OnReceived = IdLogEvent1Received;
IdFTP1->Intercept = IdLogEvent1;
IdLogEvent1->Active = true;
IdFTP1->Host = "localhost";
IdFTP1->Username = "guest";
IdFTP1->Password = "guest@1234";
IdFTP1->Connect();
IdFTP1->List();
Memo1->Lines->Assign(IdFTP1->ListResult);
 
}
//---------------------------------------------------------------------------
 
void __fastcall TForm1::IdLogEvent1Received(TComponent *ASender,
      const AnsiString AText, const AnsiString AData)
{
Memo2->Lines->Add(AText+" - "+AData);
}
//---------------------------------------------------------------------------

Open in new window

0
 
prunesquallorAuthor Commented:
Dear Morris,

Magic - that's perfect! Thanks!

As far as I can tell I was specifying TObject rather than TComponent.

I'll accept this as the solution!

ATB

John B
0
 
prunesquallorAuthor Commented:
Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now