如何在C中使用重命名功能 [英] How to use rename function in C

查看:74
本文介绍了如何在C中使用重命名功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用重命名(const char * oldpath,const char * newpath)来移动文件或目录?

How to use rename(const char *oldpath, const char *newpath) for move the file or directory ?

推荐答案

如果你用google搜索过,你可能不会需要这个问题。无论如何



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

Quote:

rename()函数应改名称一份文件。旧参数指向要重命名的文件的路径名。新参数指向文件的新路径名。

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.

#include <stdio.h>

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





阅读本文了解详情。

重命名(3):重命名文件 - Linux手册页 [ ^ ]


这篇关于如何在C中使用重命名功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆