欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Linux系统编程 - 25. 文件IO之 lseek

程序员文章站 2022-05-24 10:26:25
...

 Linux系统编程 - 25. 文件IO之 lseek

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&
相关标签: Linux C编程