(Unicode C) Create Directory on FTP Server
Unicode C example showing how to create a new directory on an FTP site.
#include <C_CkFtp2W.h>
void ChilkatSample(void)
{
HCkFtp2W ftp;
BOOL success;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
ftp = CkFtp2W_Create();
CkFtp2W_putHostname(ftp,L"ftp.example.com");
CkFtp2W_putUsername(ftp,L"login");
CkFtp2W_putPassword(ftp,L"password");
// Connect and login to the FTP server.
success = CkFtp2W_Connect(ftp);
if (success != TRUE) {
wprintf(L"%s\n",CkFtp2W_lastErrorText(ftp));
CkFtp2W_Dispose(ftp);
return;
}
// Create a new directory on the FTP server:
success = CkFtp2W_CreateRemoteDir(ftp,L"newDirName");
if (success != TRUE) {
wprintf(L"%s\n",CkFtp2W_lastErrorText(ftp));
CkFtp2W_Dispose(ftp);
return;
}
success = CkFtp2W_Disconnect(ftp);
CkFtp2W_Dispose(ftp);
}
|