SECFileSystem::RenameFile

BOOLSECFileSystem::RenameFile(const CString&OldFileName, const CString&NewFileName)

Renames a file.

Defined in: filesys.cpp

Return Value

Nonzero if successful; 0 if an error occurred.

Parameters

OldFileName

The name of the file to rename.

NewFileName

The new name of the file.

Comments

To rename a file. A file can also be moved from one directory to another in the same filesystem by specifying a new directory (in addition to the filename) in the second parameter.

It is not an error to rename a file to the same name.

Example

BOOL bRetVal = fs.RenameFile("c:\\foo.txt", "c:\\bar.doc");
ASSERT(fs.RenameFile("c:\\foo.txt", "c:\\foo.txt") == TRUE);
ASSERT(fs.RenameFile("c:\\foo.txt", "c:\\bar\\foo.txt") == TRUE);

See Also

SECFileSystem  RenameDirectory