Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This static function renames the specified file.
static void PASCAL Rename(
LPCTSTR lpszOldName,
LPCTSTR lpszNewName,
CAtlTransactionManager* pTM = NULL
);
Parameters
lpszOldName
The old path.lpszNewName
The new path.pTM
Pointer to CAtlTransactionManager object
Remarks
Directories cannot be renamed. This is equivalent to the REN command.
Example
TCHAR* pOldName = _T("Oldname_File.dat");
TCHAR* pNewName = _T("Renamed_File.dat");
try
{
CFile::Rename(pOldName, pNewName);
}
catch(CFileException* pEx )
{
TRACE(_T("File %20s not found, cause = %d\n"), pOldName,
pEx->m_cause);
pEx->Delete();
}
Requirements
Header: afx.h