LInetFtp::RenameFile

#include "ltwrappr.h"

L_INT LInetFtp::RenameFile(pszOldName, pszNewName)

L_TCHAR *pszOldName;

/* old file name */

L_TCHAR *pszNewName;

/* new file name */

Renames a file stored on the FTP server.

Parameter

Description

pszOldName

Character string that contains the name of the file that will have its name changed on the remote FTP server. This is a NULL-terminated string.

pszNewName

Character string that contains the new name for the remote file. This is a NULL-terminated string.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

If the file specified in pszNewName already exists, this function will fail.

Required DLLs and Libraries

LTFIL
LTWEB

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application

See Also

Functions:

LInetFtp::SendFile, LInetFtp::GetFile, LInetFtp::RemoveFile, Class Members

Topics:

FTP Functions: Remote File Operations

 

How to Program with the LInetFtp Class

Example

This example renames a remote file on an FTP server.

L_INT LInetFtp_RenameFileExample(HWND hWndParent, L_TCHAR *pszOld, L_TCHAR *pszNew)
{
   L_INT nRet;
   LInetFtp InetFtp(TEXT("www.leadtools.com"));
   // Checking if the connection failed
   nRet = InetFtp.GetErrorFromList ();
   if(nRet != SUCCESS)
   {
      InetFtp.DisplayError (hWndParent, TEXT("Can't connect to the FTP server"));
      return nRet;
   }
   nRet = InetFtp.RenameFile(pszOld, pszNew);
   if(nRet != SUCCESS)
   {
      InetFtp.DisplayError(hWndParent, TEXT("Can't rename a remote file, an error within the server"));
      return nRet;
   }
   return SUCCESS;
}