(Unicode C) Delete Remote File
Delete a remote file.
#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.chilkatsoft.com");
CkFtp2W_putUsername(ftp,L"myLogin");
CkFtp2W_putPassword(ftp,L"myPassword");
// 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;
}
// Set the current remote directory to where the file
// is located:
success = CkFtp2W_ChangeRemoteDir(ftp,L"/testing");
if (success != TRUE) {
wprintf(L"%s\n",CkFtp2W_lastErrorText(ftp));
CkFtp2W_Dispose(ftp);
return;
}
success = CkFtp2W_DeleteRemoteFile(ftp,L"goodbye.txt");
if (success != TRUE) {
wprintf(L"%s\n",CkFtp2W_lastErrorText(ftp));
CkFtp2W_Dispose(ftp);
return;
}
success = CkFtp2W_Disconnect(ftp);
CkFtp2W_Dispose(ftp);
}
|