Unicode C
Unicode C
Transition from SFtp.ReadDir to SFtp.ReadDirListing
Provides instructions for replacing deprecated ReadDir method calls with ReadDirListing.Chilkat Unicode C Downloads
#include <C_CkSFtpW.h>
#include <C_CkSFtpDirW.h>
void ChilkatSample(void)
{
BOOL success;
HCkSFtpW sftp;
const wchar_t *handle;
HCkSFtpDirW dirObj;
HCkSFtpDirW dirOut;
success = FALSE;
sftp = CkSFtpW_Create();
// ...
// ...
handle = CkSFtpW_openDir(sftp,L".");
// ...
// ...
// ------------------------------------------------------------------------
// The ReadDir method is deprecated:
dirObj = CkSFtpW_ReadDir(sftp,handle);
if (CkSFtpW_getLastMethodSuccess(sftp) == FALSE) {
wprintf(L"%s\n",CkSFtpW_lastErrorText(sftp));
CkSFtpW_Dispose(sftp);
return;
}
// ...
// ...
CkSFtpDirW_Dispose(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.
dirOut = CkSFtpDirW_Create();
success = CkSFtpW_ReadDirListing(sftp,handle,dirOut);
if (success == FALSE) {
wprintf(L"%s\n",CkSFtpW_lastErrorText(sftp));
CkSFtpW_Dispose(sftp);
CkSFtpDirW_Dispose(dirOut);
return;
}
// ...
// ...
CkSFtpW_CloseHandle(sftp,handle);
CkSFtpW_Dispose(sftp);
CkSFtpDirW_Dispose(dirOut);
}