Sample code for 30+ languages & platforms
Unicode C++

Transition from SFtp.ReadDir to SFtp.ReadDirListing

Provides instructions for replacing deprecated ReadDir method calls with ReadDirListing.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkSFtpW.h>
#include <CkSFtpDirW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkSFtpW sftp;

    //  ...
    //  ...

    const wchar_t *handle = sftp.openDir(L".");
    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The ReadDir method is deprecated:

    CkSFtpDirW *dirObj = sftp.ReadDir(handle);
    if (sftp.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",sftp.lastErrorText());
        return;
    }

    //  ...
    //  ...

    delete dirObj;

    //  ------------------------------------------------------------------------
    //  Do the equivalent using ReadDirListing.
    //  Your application creates a new, empty SFtpDir object which is passed 
    //  in the last argument and filled upon success.

    CkSFtpDirW dirOut;
    success = sftp.ReadDirListing(handle,dirOut);
    if (success == false) {
        wprintf(L"%s\n",sftp.lastErrorText());
        return;
    }

    //  ...
    //  ...

    sftp.CloseHandle(handle);
    }