c++ 文件操作 重新命名 删除

学内容:

l 文件重命名rename

l 文件删除remove

文件重命名rename

int rename( const char *oldname, const char *newname );

oldname //需要重命名的文件名

newname //新的文件名

文件删除remove

int remove( const char *path );

文件全路径

c:\\windows\\system\\test.txt 不能写为c:\windows\system\test.txt

因为\\才表示"\"

文件名不能包含:/\*?"<>| 这几个字符