/*** 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