rename、remove

/***
remove.c
***/
#include<stdio.h>

int main()
{
    remove("./b.txt");
}

运行结果:

ubuntu1604@ubuntu:~/wangqinghe/C/20190728$ gedit remove.c b.txt

^C

ubuntu1604@ubuntu:~/wangqinghe/C/20190728$ gcc remove.c -o remove

ubuntu1604@ubuntu:~/wangqinghe/C/20190728$ ls

a.txt  b.txt  flush.  flush.c  remove  remove.c

ubuntu1604@ubuntu:~/wangqinghe/C/20190728$ ./remove

ubuntu1604@ubuntu:~/wangqinghe/C/20190728$ ls

a.txt  flush.  flush.c  remove  remove.c

 

/***
rename.c
***/
#include<stdio.h>

int main()
{
    rename("./a.txt","./b.txt");
    return 0;
}

运行结果:

ubuntu1604@ubuntu:~/wangqinghe/C/20190728$ ./rename

ubuntu1604@ubuntu:~/wangqinghe/C/20190728$ ls

b.txt  flush.  flush.c  remove  remove.c  rename  rename.c

posted @ 2019-07-28 20:44  王清河  阅读(187)  评论(0编辑  收藏  举报