CFile::Rename
This static function renames the specified file.
static void PASCAL Rename(
LPCTSTR lpszOldName,
LPCTSTR lpszNewName
);
Параметры
lpszOldName
The old path.lpszNewName
The new path.
Заметки
Directories cannot be renamed. This is equivalent to the REN command.
Пример
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();
}
Требования
Header: afx.h