int rename (const char *oldpath, const char *newpath);
執行成功時,
rename()
會把路徑名稱
oldpath
更名為
newpath
。檔案的內容與inode則維
持不變。
oldpath
與
newpath
必須位於相同的檔案系統
6
;否則,此呼叫將執行失敗。
mv
之類的公用程式必須藉由複製以及移除連結來處理此情況。
執行成功時,
rename()
會傳回
0
,檔案從前參照自
oldpath
而現在參照自
newpath
。執行
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.