Using Chilkat in Managed C++

The Chilkat VC++ static libraries are for unmanaged C++ applications. A Managed C++ application (using Microsoft’s Managed Extensions for C++) runs within the .NET Framework and therefore must use the Chilkat .NET assembly.

The Chilkat C++ online reference documentation and online examples are for unmanaged C++ applications. For Managed C++, the best choice is to read the C# online documentation and C# online examples (at example-code.com). Managed C++ syntax is closer to C# syntax than unmanaged C++ syntax.

To see the differences in syntax, here are some sample code fragments in unmanaged C++, Managed C++, and C#.

Unmanaged C++

#include <CkFtp2.h>

void FtpExample(void)
    {
    CkFtp2 ftp;

    //  Any string unlocks the component for the 1st 30-days.
    bool success = ftp.UnlockComponent("Anything for 30-day trial");

    ftp.put_Hostname("ftp.example-code.com");
    ftp.put_Username("myLogin");
    ftp.put_Password("myPassword");

    success = ftp.Connect();

 ...

Managed C++

    Chilkat::Ftp2 ftp;
    ftp.UnlockComponent("30-day trial");

    ftp.Hostname = "www.example-code.com";
    ftp.Username = "myLogin";
    ftp.Password = "myPassword";

    bool success = ftp.Connect();

    ....

C#

Chilkat.Ftp2 ftp = new Chilkat.Ftp2();

bool success = ftp.UnlockComponent("Anything for 30-day trial");

ftp.Hostname = "ftp.example-code.com";
ftp.Username = "myLogin";
ftp.Password = "myPassword";

success = ftp.Connect();

...