Linux系统编程 - 25. 文件IO之 lseek
程序员文章站
2022-05-24 10:26:25
...
aaa@qq.com:~/linux/sys/20201201$ sudo vim write.c
aaa@qq.com:~/linux/sys/20201201$ sudo gcc write.c -o write
aaa@qq.com:~/linux/sys/20201201$ ./write
File open error
aaa@qq.com:~/linux/sys/20201201$ ls
open open.c write write.c
aaa@qq.com:~/linux/sys/20201201$ sudo ./write
Current location:0
aaa@qq.com:~/linux/sys/20201201$ ls
open open.c write.c.bak write write.c
aaa@qq.com:~/linux/sys/20201201$ cat write.c.bak
cat: open.c.bak: Permission denied
aaa@qq.com:~/linux/sys/20201201$ sudo cat write.c.bak
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h&