f_rename
Use this function to rename a file or directory.
If a file or directory is read-only it cannot be renamed. If a file is open it cannot be renamed.
Format
int f_rename (
const char * filename,
const char * newname)
Arguments
Argument | Description | Type |
---|---|---|
filename | The file or directory name, with or without its path. | char * |
newname | The new name of the file or directory (without the path). | char * |
Return values
Return value | Description |
---|---|
F_NOERR | Successful execution. |
Else | See Error Codes. |
Example
void myfunc( void )
{
.
.
f_rename( "oldfile.txt", "newfile.txt" );
f_rename( "A:/subdir/oldfile.txt", "newfile.txt" );
.
.
}