完整包含linux下文件和目录的各种操作和注意事项,是此类开发的必备手册!
只供内部使用
目 录
2
引言 ........................................................................................................................................... 4 2.1 2.2 2.3 2.4 3
编写目的 ......................................................................................................................... 4 预期读者和阅读建议 ..................................................................................................... 4 参考资料 ......................................................................................................................... 4 缩写术语 ......................................................................................................................... 4
底层文件操作 ........................................................................................................................... 5 3.1 3.2 3.3
概述 ................................................................................................................................. 5 所需头文件 ..................................................................................................................... 5 函数列表 ......................................................................................................................... 5 3.3.1 creat ....................................................................................................................... 5 3.3.2 open ....................................................................................................................... 5 3.3.3 close ...................................................................................................................... 7 3.3.4 read ........................................................................................................................ 7 3.3.5 write ...................................................................................................................... 8 3.3.6 lseek ...................................................................................................................... 8 3.3.7 access .................................................................................................................... 9 3.3.8 link ...................................................................................................................... 10 3.3.9 unlink .................................................................................................................. 10 3.3.10 fcntl ................................................................................................................... 10 3.3.11 stat ..................................................................................................................... 12 3.4 综合示例 ....................................................................................................................... 12
4 5
带缓冲区的文件操作 ............................................................................................................. 12 目录操作 ................................................................................................................................. 12