Linux&C open creat read write lseek 函数用法总结
一:五个函数的参数以及返回值。
| 函数 | 参数 | 返回值 |
| open | (文件名,打开方式以及读写方式,文件的权限) | 读取成功返回文件描述符fd(0-255), 失败返回-1 |
| creat | (char*(文件名称),文件的权限) | 创建成功返回文件描述符,失败返回-1 |
| read | (fd,read_buf(缓存区,相当于一块空间),count(要读的长度)) | 读取成功返回读取的长度,读取 失败返回-1 |
| write | (fd,write_buf(要写入文件的内容,路径),count(要写入的字节)) | 写入成功返回写入的长度,写入失败返回-1 |
| lseek | (fd,offset(移动的量),从什么位置) | 移动成功返回从文件开头到现在指针位置的字节 数 |
1:open : https://github.com/yangbodong22011/linuxc/blob/master/20150719/my_creat.c
2:creat: https://github.com/yangbodong22011/linuxc/blob/master/20150721/umask.c
3:read: https://github.com/yangbodong22011/linuxc/blob/master/20150720/read.c
4:write: https://github.com/yangbodong22011/linuxc/blob/master/20150721/unlink.c
5:lseek:https://github.com/yangbodong22011/linuxc/blob/master/20150720/my_lseek.c
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
阅读(1) | 评论(0) | 转发(0) |
相关热门文章
给主人留下些什么吧!~~
评论热议
浙公网安备 33010602011771号