Indy TIdFTP Client Example in CPP?

Posted on 2009-04-21
Last Modified: 2013-11-17
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.



All help gratefully received.
Question by:prunesquallor
    LVL 2

    Accepted Solution

    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";
    void __fastcall TForm1::IdLogEvent1Received(TComponent *ASender,
          const AnsiString AText, const AnsiString AData)
    Memo2->Lines->Add(AText+" - "+AData);

    Open in new window


    Author Comment

    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!


    John B

    Author Closing Comment


    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
    Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
    The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now