Click here to Skip to main content
15,895,538 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to use rename(const char *oldpath, const char *newpath) for move the file or directory ?
Posted

1 solution

If you have had googled you might not need this question. Any way

Quote:
The rename() function shall change the name of a file. The old argument points to the pathname of the file to be renamed. The new argument points to the new pathname of the file.
C++
#include <stdio.h>

int status;
...
status = rename("/home/cnd/mod1", "/home/cnd/mod2");


Read this for aditional details.
rename(3): rename file - Linux man page[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900